Problems using OpenCV 2.4.3 with QT



  • Dear all,

    I am facing problem in using OpenCV 2.4.3 with QT. I downloaded built version of OpenCV 2.4.3 from opencv website. It works with Visual Studio 2010.
    My QT application works when I use old interfaces like IplImage, CvCapture etc.
    I get undefined reference errors, as soon as I start using new interfaces lik cv::Mat, cv::VideoCapture. This is my QT project file including includes and libs for OpenCV:

    @
    INCLUDEPATH += C:/OpenCV2.4.3/include/
    INCLUDEPATH += C:/OpenCV2.4.3/include/opencv/
    INCLUDEPATH += C:/OpenCV2.4.3/include/opencv2/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/core/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/imgproc/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/video/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/features2d/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/calib3d/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/objdetect/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/legacy/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/photo/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/ml/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/contrib/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/flann/include/
    INCLUDEPATH += C:/OpenCV2.4.3/modules/highgui/include/

    CONFIG(release,debug|release)
    {
    LIBS += C:\opencv2.4.3\build\x86\vc10\lib\opencv_calib3d243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_contrib243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_core243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_features2d243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_flann243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_gpu243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_haartraining_engine.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_highgui243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_imgproc243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_legacy243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_ml243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_objdetect243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_ts243.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_video243.lib
    }

    CONFIG(debug,debug|release)
    {
    LIBS += C:\opencv2.4.3\build\x86\vc10\lib\opencv_calib3d243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_contrib243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_core243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_features2d243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_flann243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_gpu243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_haartraining_engined.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_highgui243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_imgproc243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_legacy243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_ml243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_objdetect243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_ts243d.lib
    C:\opencv2.4.3\build\x86\vc10\lib\opencv_video243d.lib
    }
    @
    Does any body has faced similar situation?

    [EDIT] I build OpenCV 2.4.6 with MinGW/QT support using CMake. I still face the same problem as mentioned above. My application works for IplImage format and give error 0xc0000139 while executing the application.

    @
    INCLUDEPATH += C:/2.4.6/install/include/
    INCLUDEPATH += C:/2.4.6/install/include/opencv/
    INCLUDEPATH += C:/2.4.6/install/include/opencv2/

    LIBS += -LC:\2.4.6/install/lib/
    LIBS += -llibopencv_calib3d290d -llibopencv_contrib290d -llibopencv_core290d -llibopencv_features2d290d -llibopencv_flann290d -llibopencv_highgui290d -llibopencv_imgproc290d -llibopencv_legacy290d -llibopencv_ml290d -llibopencv_objdetect290d -llibopencv_video290d
    @

    Regards,



  • Any solution?

    A working Qt - MinGW combination and configuration is needed :-)



  • Hi I use OpenCV 2.4.6 built wih MinGW with Qt (MinGW). This is my pro file:

    INCLUDEPATH += ../../opencv-2.4.6.1/include
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/calib3d/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/contrib/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/core/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/features2d/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/flann/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/highgui/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/imgproc/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/legacy/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/ml/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/objdetect/include/
    INCLUDEPATH += ../../opencv-2.4.6.1/modules/video/include/

    unix {
    unix:!mac {
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_calib3d.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_contrib.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_core.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_features2d.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_flann.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_highgui.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_imgproc.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_legacy.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_ml.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_objdetect.so
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_video.so
    }
    unix:mac {
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_core.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_calib3d.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_features2d.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_flann.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_highgui.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_imgproc.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_legacy.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_ml.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_objdetect.dylib
    LIBS += ../../opencv-2.4.6.1/lib/libopencv_video.dylib
    }
    }

    windows {
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_calib3d246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_contrib246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_core246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_features2d246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_flann246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_highgui246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_imgproc246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_legacy246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_ml246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_objdetect246.dll.a
    LIBS += C:/home/denis/Cpp/opencv-2.4.6.1/lib/libopencv_video246.dll.a
    }



  • Hi, MrDebug

    Thanks for the information.

    The question is:
    Which version of Qt /QtCreator / MinGW / OpenCV do you use? (if this is not an official build, please post the link - or if you build your own, please indicate that too)

    I don't know how can others manage those two together, but I cannot make them work together:
    http://qt-project.org/forums/viewthread/33236/

    Thanks for your help.

    Regards:
    Bence



  • Hi.
    I use the Qt5.1 mingw32 package on Windows with qtcreator embedded.
    I have built OpenCV 2.4.6 from source always with mingw32 (Be carefull! You have to dowload a src package for Windows and another src package for Mac and Linux.).
    I use the same version of Qt and OpenCV in Mac and Linux without any problem.

    Bye bye.



  • I succeed to compile OpenCV using this tutorial:
    http://stackoverflow.com/questions/15881913/how-to-link-opencv-in-qtcreator-and-use-qt-library

    ...and now Qt and OpenCV working together

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.