Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED][ERROR] [HELP] Using Qt + OpenCV to get what does webcam see
Forum Updated to NodeBB v4.3 + New Features

[SOLVED][ERROR] [HELP] Using Qt + OpenCV to get what does webcam see

Scheduled Pinned Locked Moved General and Desktop
25 Posts 4 Posters 11.5k Views 2 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.
  • Y Offline
    Y Offline
    YDYD
    wrote on last edited by
    #3

    Hi.
    For dialog I din change. But I change the cameradevice to QObject

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

      How did you create your dialog ?

      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
      • Y Offline
        Y Offline
        YDYD
        wrote on last edited by
        #5

        Qt GUI application. Qmainwindow

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

          Then how did it become a QDialog ?

          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
          • Y Offline
            Y Offline
            YDYD
            wrote on last edited by
            #7

            errr, I changed the QMainwindow to QDialog manually, i should use QMainwindow or QDialog to create Dialog class?

            1 Reply Last reply
            0
            • Y Offline
              Y Offline
              YDYD
              wrote on last edited by
              #8

              [UPDATE]
              After correction, I get another error as following:

              ERROR
              @pi@raspberrypi:~/qt/Dialog$ qmake -project
              pi@raspberrypi:~/qt/Dialog$ qmake Dialog.pro
              pi@raspberrypi:~/qt/Dialog$ make
              g++ -Wl,-O1 -o Dialog cameradevice.o dialog.o main.o moc_cameradevice.o moc_dialog.o -L/usr/lib/arm-linux-gnueabihf -lQtGui -lQtCore -lpthread
              cameradevice.o: In function CameraDevice::CameraDevice(QObject*)': cameradevice.cpp:(.text+0x24): undefined reference to cv::VideoCapture::VideoCapture()'
              cameradevice.o: In function cv::Mat::~Mat()': cameradevice.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x70): undefined reference to cv::fastFree(void*)'
              cameradevice.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x7c): undefined reference to `cv::Mat::deallocate()'
              collect2: ld returned 1 exit status
              make: *** [Dialog] Error 1@

              1 Reply Last reply
              0
              • JeroentjehomeJ Offline
                JeroentjehomeJ Offline
                Jeroentjehome
                wrote on last edited by
                #9

                The error is because the CameraDevice class is unable to find the cv class when calling it's static member function: VideoCapture. What type of library do you include? Or do you use the QLibrary for that??

                Greetz, Jeroen

                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  YDYD
                  wrote on last edited by
                  #10

                  i include

                  1. highgui
                  2. cv
                  3. cxcore
                  1 Reply Last reply
                  0
                  • Y Offline
                    Y Offline
                    YDYD
                    wrote on last edited by
                    #11

                    From my knowledge,

                    VideoCapture is under highgui.hpp.

                    i have include this file already.

                    anyone knwo what is happening?

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

                      You are not linking to the OpenCV libraries

                      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
                      • Y Offline
                        Y Offline
                        YDYD
                        wrote on last edited by
                        #13

                        Do you mean in XXX.pro file ?

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

                          Yes indeed, in you project pro file

                          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
                          • Y Offline
                            Y Offline
                            YDYD
                            wrote on last edited by
                            #15

                            @OPENCV_PATH = /usr/local/include/opencv2/
                            LIBS_PATH = /usr/local/include/opencv/
                            LIBS += -L$$LIBS_PATH
                            -lcv
                            -lhighgui
                            -lcxcore

                            INCLUDEPATH += $$OPENCV_PATH/core
                            $$OPENCV_PATH/highgui/@

                            This is how my linking look like

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

                              Are you sure you are linking to all the needed libraries ?

                              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
                              • Y Offline
                                Y Offline
                                YDYD
                                wrote on last edited by
                                #17

                                no, i am nt sure, but i checked many times if i left out any.
                                Should not be left out...
                                if this is not left out of libraries, what is the problem ?

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

                                  Just a missing library. You can check with pkg-config what you need. You can even use it within your pro file (have a look at qmake's documentation)

                                  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
                                  • Y Offline
                                    Y Offline
                                    YDYD
                                    wrote on last edited by
                                    #19

                                    Ok. I give it a try and looh. Thx a lot SGaist

                                    1 Reply Last reply
                                    0
                                    • Y Offline
                                      Y Offline
                                      YDYD
                                      wrote on last edited by
                                      #20

                                      [quote author="SGaist" date="1403731430"]Just a missing library. You can check with pkg-config what you need. You can even use it within your pro file (have a look at qmake's documentation) [/quote]

                                      Don't really know how to do....
                                      I just have a look at the qmake genarated makefile. The INCPATH inside should be the openCV path ? It is different.
                                      the another thing to mention is, after i qmake project, my Dialog.pro file will changed. the coding will all replaced.

                                      i am new to Qt and OpenCV, i just could not link them up.

                                      Thanks to SGaist again,

                                      1 Reply Last reply
                                      0
                                      • Y Offline
                                        Y Offline
                                        YDYD
                                        wrote on last edited by
                                        #21

                                        Hi SGaist,

                                        Finally I did it!

                                        I make a slightly change in "qmake.conf" file which is under @/usr/share/qt4/mkspecs/default/qmake.conf@

                                        I added in the INCLUDEPATH and LIBS.
                                        Then it Works!!

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

                                          Don't modify that file, that will make all your projects link to OpenCV. Just correct your pro file with what you added there.

                                          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