I´m using Qt 5.0.2 and try to get started with OpenCv.
If I run the following program, it only shows a console and says press any key but it shows no image. I don´t even get the qDebug() messages.
However, with the Opencv stuff deleted I get the messages.
PS: yes I made sure that the Desert.jpg is in the same folder where the exe is. first-openCV-test.pro:
QT += core
QT -= gui
TARGET = first-openCV-test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += F:\\QT\\libraries\\opencv\\opnecv_build_2.4.5\\install\\include
LIBS += -LF:\\QT\libraries\\opencv\\opnecv_build_2.4.5\\install\\lib \
-lopencv_core245.dll \
-lopencv_highgui245.dll \
-lopencv_imgproc245.dll \
-lopencv_features2d245.dll \
-lopencv_calib3d245.dll
main.cpp:
#include <QDebug>
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char *argv[])
{
// read an image
qDebug()<< "start initialising";
cv::Mat image= cv::imread("Desert.jpg");
// create image window named "My Image"
qDebug()<< "name Window";
cv::namedWindow("My Image");
// show the image on window
qDebug()<< "show image: ";
cv::imshow("My Image", image);
// wait key for 5000 ms
qDebug()<< "wait";
cv::waitKey(5000);
return 1;
}
//////////////////////////////////////////////////////////////////////////////////////////
thanks for the fast answers.
I tried some things and also rebuilt all and re-downloaded it. I changed it to this:
QT += core
QT -= gui
TARGET = first-test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += "F:/QT/libraries/opencv/build/include" \
"F:/QT/libraries/opencv/build/include/opencv" \
"F:/QT/libraries/opencv/build/include/opencv2"
LIBS += -L"F:/QT/libraries/opencv/build/x86/mingw/lib"
-libopencv_core245.dll
-libopencv_highgui245.dll
-libopencv_imgproc245.dll
-libopencv_features2d245.dll
-libopencv_calib3d245.dll
But now I get the following errors:
F:\A_PROJECTS\OPEN-CV\first-test\first-test\main.cpp:-1: Fehler:undefined reference to `cv::fastFree(void*)'
F:\A_PROJECTS\OPEN-CV\first-test\first-test\main.cpp:-1: Fehler:undefined reference to `cv::Mat::deallocate()'