Monday, 15 February 2010

c++ - Qt with OpenCv does nothing -


I'm using QT 5.0.2 and try to get started with OpenCV.

If I run the following program, it shows only a console and presses any key but it does not show any image, I do not even get the qDebug () message.

However, I got the message by removing OpenCV stuff.

PS: Yes I have ensured that the Desert JPG is in the same folder where XE is first-openCV-test.pro:

  QT + = Core QT - = gui target = first openCV tests CONFIG + = console config - = App_bundle Template = app source + = main.cpp INCLUDEPATH + = F: \\ \\ Qt libraries Opencv \\ \\ \\ Opnecv_build_2k4k5 set \\ LIBS + = -LF: \\ Qt \ libraries \\ \\ Opencv Opnecv_build_2k4k5 \\ install \\ lib \ -lopencv_core245.dll \ -lopencv_highgui245.dll \ -lopencv_imgproc245.dll \ -lopencv_features2d245.dll \ -lopencv_calib3d245.dll   

main.cpp:

  Include # lt; QDebug & gt; # Include & lt; QCoreApplication & gt; #include & lt; Opencv2 / core / core.hpp & gt; #include & lt; Opencv2 / highgui / highgui.hpp & gt; Int main (int argc, char * argv []) {// read an image qDebug () << & Lt; "Start Getting Started"; Cv :: Mat image = cv :: imread ("Desert.jpg"); // Create an image window named "My image" qDebug () & lt; & Lt; "Name window"; Cv :: nameWindow ("My Image"); // Show image on window qDebug () & lt; & Lt; "Show image:"; Cv :: imshow ("My image", Image); // wait for 5000 ms. QDebug () & lt; & Lt; "stop"; CV :: waitKey (5000); Return 1; }   

////////////////////////////////////// //////////////////////////////////////////////// //

Thanks for the quick reply.

I tried some things and made them all again and downloaded it again. I changed it for:
QT + = Core QT - = GUI target = First test configuration + = console config - = app_bundle template = application source + = main.cpp

  INCLUDEPATH + = 'F / QT / libraries / opencv / build / include "\" F / QT / libraries / opencv / Construction / / Opencv include "\" F / QT / libraries / opencv / Construction / / in opencv2 Includes "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 (Zero *) '

F: \ A_PROJECTS \ Open CV \ First Test \ first test \ main.cpp: -1: Fehler: `CV :: mat undefined reference:: Deallocate () '

I'm not sure if this will help, but try Do ...

First of all, in my programs I ' \\ < / Strong> 'instead of' / 'bars. Second, I never put it. Libs on DLL

LIBS + = -LC: / OpenCV / lib / -libopencv_core245 -llibopencv_highgui245 -llibopencv_imgproc245

Try to make those changes and I Use something like this again to 'run qmake' and 'rebuild all' if you are using qtcreator.

No comments:

Post a Comment