Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Opencv in Qt
Forum Updated to NodeBB v4.3 + New Features

Opencv in Qt

Scheduled Pinned Locked Moved 3rd Party Software
8 Posts 3 Posters 4.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    actionking
    wrote on last edited by
    #1

    Hi friends,
    I have been to call the opencv function from Qt(Qml),but it doesn't working well...It always showing error(Undefined reference to cvLoadImage,cvNamedWindow,etc.)....But when i run that opencv code in console application means ,it is running well..But when i using it with Qt,it is displaying this error..Could anyone please sought out the problem..
    thanks in advance..

    1 Reply Last reply
    0
    • A Offline
      A Offline
      actionking
      wrote on last edited by
      #2

      hello friends,
      No idea about this?????????

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Please allow at least 24 to 72 hours before bumping your own thread. Not all people on this forum live the same timezone as you or even might have an answer.

        If you are having undefined reference it means that you are not linking the library to your application when compiling.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          actionking
          wrote on last edited by
          #4

          Hi SGaist,
          Sorry for the delay sir. I've used pro file as
          @
          LIBS += -L/usr/local/lib
          -lopencv_core
          -lopencv_imgproc
          @

          This is what i'm trying. From Qml, i'm calling a function.
          @
          QString mainwindow::get_opencv(QString &get_word)
          {
          IplImage *img2 = cvLoadImage("images_.png");
          CvPoint pt1 = cvPoint(130,90);
          int thickness = 2;
          char text[20];
          char m_framecnt[100]="kannamohan";
          CvScalar blue = CV_RGB(0,0,250);
          double hscale = 1.0;
          double vscale = 1.0;
          double shear = 0;
          //int thickness2 = 1;
          int line_type = 4;
          snprintf(text,sizeof(text), "%s",m_framecnt);
          cvNamedWindow("Window",CV_WINDOW_AUTOSIZE);
          CvFont font1 ;//= fontQt("Times");
          cvInitFont(&font1,CV_FONT_HERSHEY_DUPLEX,hscale,vscale,shear,thickness,line_type);
          cvPutText(img2,text,pt1,&font1,blue);
          cvShowImage("Window",img2);
          cvWaitKey(0);
          cvReleaseImage(&img2);
          cvDestroyWindow("Window");
          }
          @
          It is telling undefined reference to cvLoadImage,CvPoint,etc..
          please help me sir..

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            I would say you are not linking to opencv_highgui

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • R Offline
              R Offline
              refuzee
              wrote on last edited by
              #6

              Hi,

              have you set all your includepaths properly and added all necessary variables to your system environment variables ?

              a quick guide to use qtcreator with opencv is here:

              http://www.barbato.us/2010/09/20/using-opencv-within-qtcreator-in-windows/

              I'm sure you can search the net for more guides.

              In your case you might be missing:

              #include <opencv2/core/core.hpp>
              #include <opencv2/highgui/highgui.hpp>

              as well, or equivalent.

              As in the tutorial you might also add:

              INCLUDEPATH += C:\OpenCVx.x\include
              LIBS += -LC:\OpenCVx.x\lib
              -lopencv_corexyz
              -lopencv_highguixyz\

              To your .pro.
              While placeholders x y and z represent versionsing.

              How to set this up is also explained in OpenCV 2 Computer Vision Application Programming Cookbook by Robert Laganière.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                actionking
                wrote on last edited by
                #7

                hi SGaist and Refuzee,
                You both are right.I'm working in linux. I have missed that -lopencv_highgui \ in profile
                Thank you a lot... Still it is not over,i need to check that application.Tomorrow i will check it and i will tell the working process

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Since you're on linux you can take advantage of pkg-config

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved