OpenCV integration with Qt creator
hi
I am new to OpenCV and i want to use OpenCV libraries to my application but i don't know the proper way to configure it with Qt creator IDE.
i have gone through many post regarding my problem but it seems to be a bit higher level and i am searching for basic configuration with Qt creator.
Thanks...
Re: OpenCV integration with Qt creator
As for any other 3rd party library, you have to add include path to your .pro file:
Code:
// project.pro
INCLUDEPATH += C:/OpenCV/cv/include \
C:/OpenCV/cvaux/include \
// ... other components if needed
and library path for linker (this is for dynamic linking):
Code:
// project.pro
LIBS += -LC:/OpenCV/bin //!< path to .dll files
LIBS += -lcv100 -lcvaux100 // here cv100.dll and cvaux.dll are linked, add other libs if needed
Last thing to do is to configure the QtCreator indexer, to be able to use code completion with symbols from OpenCV library.
I don't know if there is a way to "click" it, I've just updated the "project.includes" file (its a txt file, so you can just paste the include paths there):
Code:
// project.includes
//...
C:\OpenCV\cv\include
C:\OpenCV\cxcore\include
// other path for indexer
// ...
Now OpenCV is ready to use with your project.
All above was for OpenCV 1.0 and Windows platform, but the principle is the same for any OS and library version ( new OpenCV is separated into modules, so there will be more to include / link ).
Re: OpenCV integration with Qt creator
Code:
#-------------------------------------------------
#
# Project created by QtCreator 2011-02-18T14:52:13
#
#-------------------------------------------------
QT += core gui
TARGET = samplecv
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
CONFIG += mobility
MOBILITY =
INCLUDEPATH += C:/OpenCV2.2/include/opencv \
C:/OpenCV2.2/include/opencv2
LIBS+= C:/OpenCV2.2/lib/*.lib
symbian {
TARGET.UID3 = 0xe10417cf
# TARGET.CAPABILITY +=
TARGET.EPOCSTACKSIZE = 0x14000
TARGET.EPOCHEAPSIZE = 0x020000 0x800000
}
Am i true with this kind of declaration....i haven't been that much familiar with opencv....
if possible can you help with an Qt example together with OpenCV...
Thanks
Re: OpenCV integration with Qt creator
Ok, you have includes and libraries (I assume that paths are correct), so what exactly is the problem ? You cannot build the project ?
Re: OpenCV integration with Qt creator
Error i am getting is shown below:
Running build steps for project samplecv...
Configuration unchanged, skipping qmake step.
Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Users/mind_freak/samplecv-build-desktop'
C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/mind_freak/samplecv-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\QtSDK\Desktop\Qt\4.7.1\mingw\include\Qt Core" -I"..\..\..\QtSDK\Desktop\Qt\4.7.1\mingw\include\Qt Gui" -I"..\..\..\QtSDK\Desktop\Qt\4.7.1\mingw\include " -I"..\..\..\OpenCV2.2\include\opencv" -I"..\..\..\OpenCV2.2\include\opencv2" -I"..\..\..\QtSDK\Desktop\Qt\4.7.1\mingw\include\Ac tiveQt" -I"debug" -I"." -I"..\samplecv" -I"." -I"..\..\..\QtSDK\Desktop\Qt\4.7.1\mingw\mkspecs\wi n32-g++" -o debug\main.o ..\samplecv\main.cpp
mingw32-make[1]: Leaving directory `C:/Users/mind_freak/samplecv-build-desktop'
mingw32-make: Leaving directory `C:/Users/mind_freak/samplecv-build-desktop'
In file included from ..\samplecv\/mainwindow.h:5,
from ..\samplecv\main.cpp:2:
..\..\..\OpenCV2.2\include\opencv/cv.h:63:33: error: opencv2/core/core_c.h: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:64:33: error: opencv2/core/core.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:65:39: error: opencv2/imgproc/imgproc_c.h: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:66:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:67:38: error: opencv2/video/tracking.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:68:45: error: opencv2/features2d/features2d.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:69:35: error: opencv2/flann/flann.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:70:39: error: opencv2/calib3d/calib3d.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:71:43: error: opencv2/objdetect/objdetect.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:72:37: error: opencv2/legacy/compat.hpp: No such file or directory
..\..\..\OpenCV2.2\include\opencv/cv.h:79:37: error: opencv2/core/internal.hpp: No such file or directory
In file included from ..\samplecv\/mainwindow.h:6,
from ..\samplecv\main.cpp:2:
..\..\..\OpenCV2.2\include\opencv/highgui.h:47:39: error: opencv2/highgui/highgui_c.h: No such file or directory
..\..\..\OpenCV2.2\include\opencv/highgui.h:48:39: error: opencv2/highgui/highgui.hpp: No such file or directory
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make: *** [debug] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project samplecv (target: Desktop)
When executing build step 'Make'
Re: OpenCV integration with Qt creator
Quote:
..\..\..\OpenCV2.2\include\opencv/cv.h:63:33: error: opencv2/core/core_c.h: No such file or directory
You need to add path to "opencv2/<module>" directory to your .pro file, for each module listed in above error. Modules should be in "C:/OpenCV2.2/modules".
For example, "core" module is in:
Quote:
C:\OpenCV2.2\modules\core
, it has "include" subdir, which contains the path referenced in cv.h above. So for this module, entry in .pro file would be:
Quote:
INCLUDEPATH += C:/OpenCV2.2/modules/core/include
Look into your OpenCV 2.2 installation directory and add all missing modules path to your .pro file.
Re: OpenCV integration with Qt creator
hey when i download opencv 2.2 from sourcefroge i have two option
1)opencv.zip
2)opencv.exe for vs2010
which one to download so that i can use it with Qt creator.....
Re: OpenCV integration with Qt creator
i don't know which to select so that i can configure it properly with Qt Creator 2.0.95,
Re: OpenCV integration with Qt creator
Which compiler are you using ? I think there are prebuilt packages available for Visual C++ compilers, so this ".exe for vs" is probably this package.
I'm using g++, so I've had to build OpenCV myself ( not really difficult, just download CMake and click few times, I think there is even a step-by-step tutorial somewhere ).
So it depends on the compiler, if you use g++ download something like "OpenCV-2.2.0-win.zip".
Re: OpenCV integration with Qt creator
m using Nokia Qt sdk ,so which compiler does it consist of ??
Re: OpenCV integration with Qt creator
MinGW/GCC, unless you specified otherwise.
Re: OpenCV integration with Qt creator
I need to know how to fix the following problem that I get when I try to configure the CMake. please I need some help.