Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

OpenCV and QT cv::imread only problem...



  • Dear QT an OpenCV users,
    I have installed with CMake actual OpenCV 3.0.0 on my machine. I'm using QT Creator 5.3 with MinGW 32bit (my OS is Win7 64bit).

    This simple example code is successfully compiled:

    #include <opencv2/opencv.hpp>
    #include <opencv2/highgui/highgui.hpp>
    using namespace cv;
    int main(int argc, char *argv[])
    {
    namedWindow("Output",1);
    Mat output = Mat::zeros(120,350,CV_8UC3);
    putText(output,"Hello World :)", cvPoint(15,70),FONT_HERSHEY_PLAIN,3, cvScalar(0,255,0),4);
    imshow("Output",output);
    waitKey(0);
    return 0;
    }

    It works! So my .pro file, headers, libs, patch etc. should be ok...

    But when I try to use something my own, by adding just one line to this code like this:
    Mat src = imread("C:/test.bmp",1);

    I get the following error during compilation:
    undefined reference to `cv::imread(cv::String const&, int)'

    I don't really know what I'm doing wrong :(
    I have been searching in google etc. People have this issue but they have undefined references with all cv:: functions. I can't understand what is wrong there if my example code works (cv::imshow etc. are works).

    Those libs in my .pro file are not enought? Please, have a look:
    INCLUDEPATH += E://OpenCV//release//install//include
    LIBS += "E:\OpenCV\release\lib\libopencv_core300.dll.a"
    LIBS += "E:\OpenCV\release\lib\libopencv_highgui300.dll.a"
    LIBS += "E:\OpenCV\release\lib\libopencv_imgproc300.dll.a"
    LIBS += "E:\OpenCV\release\lib\libopencv_features2d300.dll.a"
    LIBS += "E:\OpenCV\release\lib\libopencv_calib3d300.dll.a"

    Thanks a lot in advance for any help.



  • Problem is solved thanks to user berak at OpenCV forum.

    For other users who can have this problem solution is as follows:

    some modules have changed in 3.0. to use imread()/imwrite, add:
    LIBS += "E:\OpenCV\release\lib\libopencv_imgcodecs300.dll.a"

    Regards


Log in to reply