Results 1 to 12 of 12

Thread: OpenCV integration with Qt creator

  1. #1
    Join Date
    Mar 2009
    Location
    india->gujarat->bhavnagar
    Posts
    36
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Question 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...

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: OpenCV integration with Qt creator

    As for any other 3rd party library, you have to add include path to your .pro file:
    Qt Code:
    1. // project.pro
    2. INCLUDEPATH += C:/OpenCV/cv/include \
    3. C:/OpenCV/cvaux/include \
    4. // ... other components if needed
    To copy to clipboard, switch view to plain text mode 
    and library path for linker (this is for dynamic linking):
    Qt Code:
    1. // project.pro
    2. LIBS += -LC:/OpenCV/bin //!< path to .dll files
    3. LIBS += -lcv100 -lcvaux100 // here cv100.dll and cvaux.dll are linked, add other libs if needed
    To copy to clipboard, switch view to plain text mode 

    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):
    Qt Code:
    1. // project.includes
    2. //...
    3. C:\OpenCV\cv\include
    4. C:\OpenCV\cxcore\include
    5. // other path for indexer
    6. // ...
    To copy to clipboard, switch view to plain text mode 

    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 ).

  3. The following user says thank you to stampede for this useful post:

    mind_freak (18th February 2011)

  4. #3
    Join Date
    Mar 2009
    Location
    india->gujarat->bhavnagar
    Posts
    36
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: OpenCV integration with Qt creator

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2011-02-18T14:52:13
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. TARGET = samplecv
    10. TEMPLATE = app
    11.  
    12.  
    13. SOURCES += main.cpp\
    14. mainwindow.cpp
    15.  
    16. HEADERS += mainwindow.h
    17.  
    18. FORMS += mainwindow.ui
    19.  
    20. CONFIG += mobility
    21. MOBILITY =
    22. INCLUDEPATH += C:/OpenCV2.2/include/opencv \
    23. C:/OpenCV2.2/include/opencv2
    24. LIBS+= C:/OpenCV2.2/lib/*.lib
    25. symbian {
    26.   TARGET.UID3 = 0xe10417cf
    27.   # TARGET.CAPABILITY +=
    28.   TARGET.EPOCSTACKSIZE = 0x14000
    29.   TARGET.EPOCHEAPSIZE = 0x020000 0x800000
    30. }
    To copy to clipboard, switch view to plain text mode 

    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

  5. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default 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 ?

  6. #5
    Join Date
    Mar 2009
    Location
    india->gujarat->bhavnagar
    Posts
    36
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default 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'

  7. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: OpenCV integration with Qt creator

    ..\..\..\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:
    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:
    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.

  8. The following user says thank you to stampede for this useful post:

    mind_freak (20th February 2011)

  9. #7
    Join Date
    Mar 2009
    Location
    india->gujarat->bhavnagar
    Posts
    36
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default 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.....

  10. #8
    Join Date
    Mar 2009
    Location
    india->gujarat->bhavnagar
    Posts
    36
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default 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,

  11. #9
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default 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".

  12. #10
    Join Date
    Mar 2009
    Location
    india->gujarat->bhavnagar
    Posts
    36
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: OpenCV integration with Qt creator

    m using Nokia Qt sdk ,so which compiler does it consist of ??

  13. #11
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: OpenCV integration with Qt creator

    MinGW/GCC, unless you specified otherwise.

  14. #12
    Join Date
    Jan 2013
    Posts
    1
    Qt products
    Qt/Embedded
    Platforms
    Windows

    Default 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.

Similar Threads

  1. OpenCV integration
    By sfabel in forum Qt Programming
    Replies: 47
    Last Post: 28th January 2013, 06:19
  2. OpenCV + QT integration
    By leoalvesmachado in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 09:21
  3. Using OpenCV with QT creator
    By gmiller39 in forum Newbie
    Replies: 3
    Last Post: 7th July 2010, 16:32
  4. opencv-qt-mac
    By ireneluis in forum Qt Programming
    Replies: 0
    Last Post: 16th March 2010, 16:24
  5. Eclipse Integration sans Integration
    By ChrisW67 in forum Qt Tools
    Replies: 3
    Last Post: 17th March 2009, 08:29

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.