Qt Opencv Integration
-
wrote on 30 Mar 2012, 09:19 last edited by
Hi
I am using qt sdk 1.2(qt 4.8 , creator 2.4.1) and i want to use opencv
so I downloaded opencv2.3.1 and unpacked it to c:
I wrote a simple code like hello world :
@
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;int main(void)
{
IplImage *img=cvLoadImage("c:\IMG_0300.jpg");
cvNamedWindow("window");
cvShowImage("window",img);
cvWaitKey();
return 1;
}
@
and for adding libs to my project my pro file is like this:
@
TEMPLATE = app
CONFIG += console
CONFIG -= qtSOURCES += main.cpp
HEADERS += C:\Opencv\build\include\opencv2\core\core.hpp
C:\Opencv\build\include\opencv2\highgui\highgui.hppINCLUDEPATH+=C:\Opencv\build\include\
win32: LIBS += -L$$PWD/../../../Opencv/build/x86/mingw/lib/ -llibopencv_core231
-llibopencv_highgui231
INCLUDEPATH += $$PWD/../../../Opencv/build/include/
DEPENDPATH += $$PWD/../../../Opencv/build/x86/mingw/bin/
@
but every time i run the project I see a console window that ask me to press return to close this window.
and application output says that exited with code 0
whats the problem ? -
wrote on 30 Mar 2012, 09:23 last edited by
You have no problem. This is showing only the error code on exit of your program. 0 is considered as no error.
-
wrote on 30 Mar 2012, 09:43 last edited by
but my program must show me a window and the picture on it what happens to them ?
-
wrote on 30 Mar 2012, 09:49 last edited by
Oh, sorry, I have misinterpret your issue then.
-
wrote on 30 Mar 2012, 09:52 last edited by
now do you know whats the problem ?
I changed the pro file like this and same result nothing changed.
@
TEMPLATE = app
CONFIG += console
CONFIG -= qtSOURCES += main.cpp
INCLUDEPATH += C:\opencv\build\include
INCLUDEPATH += "C:\opencv\modules\core\include"
"C:\opencv\modules\highgui\include"
BASE_PATH = c:/opencv/build/x86/mingw
CONFIG(release,debug|release)
{
win32: LIBS += -L$$BASE_PATH/lib/ -llibopencv_calib3d231
-llibopencv_contrib231
-llibopencv_core231
-llibopencv_features2d231
-llibopencv_flann231
-llibopencv_gpu231
-llibopencv_highgui231
-llibopencv_imgproc231
-llibopencv_legacy231
-llibopencv_ml231
-llibopencv_objdetect231
-llibopencv_video231
}
CONFIG(debug,debug|release)
{
win32: LIBS += -L$$BASE_PATH/lib/ -llibopencv_calib3d231
-llibopencv_contrib231
-llibopencv_core231
-llibopencv_features2d231
-llibopencv_flann231
-llibopencv_gpu231
-llibopencv_highgui231
-llibopencv_imgproc231
-llibopencv_legacy231
-llibopencv_ml231
-llibopencv_objdetect231
-llibopencv_video231
}@
-
wrote on 30 Mar 2012, 10:05 last edited by
can you try to use ?
@cvWaitKey(0);@
edit: and maybe also without CONFIG += console
-
wrote on 30 Mar 2012, 11:08 last edited by
I tried these before nothing changed with these
-
wrote on 30 Mar 2012, 11:49 last edited by
one point may be help.
when i try to debug program i get this error box :@
During the startup program exited with code 0xc0000005
@
and then another eooro box :
@
the gdb process exited unexpectedly (code 0)
@ -
wrote on 31 Mar 2012, 05:34 last edited by
one interesting thing :
when i put build configuration to msvc10 the program runs corectly
but when i put it on mingw build every thing is like what i said before.
any sugestions ? -
wrote on 31 Mar 2012, 18:46 last edited by
no idea?
no one can help? -
wrote on 31 Mar 2012, 19:37 last edited by
Do you have the Dll's in path?
-
wrote on 1 Apr 2012, 05:37 last edited by
I copied dll's to the directory of EXE file and system32
-
wrote on 2 Apr 2012, 15:54 last edited by
I did it.
finally I've downloaded mingw32 and cmake and rebuild opencv from source with qt support and it worked like a charm. -
wrote on 11 Jun 2012, 18:58 last edited by
i used the above include path files in qt but i am getting some errors like cannot open the library file calib3d231.
-
wrote on 21 Feb 2013, 15:19 last edited by
hello,
I have met the same problem, have u solved it?
I have tried again and again, but it didn't work
However, I have successed once, when I did something and restarted qt creator, but since I rewrite the .pro, it crashed. Except this, all are the same with you.