Results 1 to 9 of 9

Thread: opencv 2.3.1 + QtSDK 1.1.3

  1. #1
    Join Date
    Oct 2011
    Location
    Porto, Portugal
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default opencv 2.3.1 + QtSDK 1.1.3

    Hello all of you!

    this is my first post so please forgive me for any rule breaking and orient me so i do not make the same mistakes inf future posts!

    Well, first things first, i know there are a lot of qt+opencv posts already but after reading all of them (and i really mean ALL in the Newbie), i still can't figure out how to make the most simple piece of software running.

    As said in the title, i am running the latest QtSDK (1.1.3 online installer, downloaded here) and the most recent opencv (2.3.1 downloaded here). I'm running win7 pro SP1 32bit.
    I think i should also mention i have CMake2.8, microsoft visual c++ express edition (with SP1) and microsoft visual studio 2010 ultimate installed in my system.

    I've seen many of the posts were refering to openCV 2.3.0 instead of 2.3.1 and i downloaded both to see if i could make it work but had the same result: no success.

    I was particularly persistent with Stampede's example here.

    What i did so far:

    - after running without any success the examples and suggestions, unistalled and deleted (from folders and PATH) my previous QtSDK and openCV

    - reboot

    - installed qt (default installation option) in c:\Programming\Qt\SDK;

    - extracted opencv to c:\Programming\ and added the following to the PATH variable:
    C:\Programming\openCV\include
    C:\Programming\openCV\include\opencv
    C:\Programming\openCV\build\x86\mingw\bin

    (i did this by this order. my first questions: is there a problem with it? should i do it the other way around? which paths are the ones i really need? are this ones too many, too few?)

    - downloaded stampede's example from his post and opened it.

    - first i just runned the code and as expected got an error:
    C:\Programming\Qt\SDK\workspace\QtCvExample\src\h\ ImageCapture.h:16: error: C1083: Cannot open include file: 'cv.h': No such file or directory

    (next question: is this header missing error due to the differences in the .pro file or is there any modification i should do to make it work just at this point?)

    - assuming it is because of the .pro file i tried to make some changes in the .pro file to match my directories as everyone says. but here i encounter my first big problem. in the original .pro i find:

    win32 {
    CV11_INCLUDE = C:/OpenCV
    CV11_LIB = C:/OpenCV/lib
    CV22_INCLUDE = C:/OpenCV2.2/modules
    CV22_LIB = C:/OpenCV2.2/build/bin
    } else{
    CV11_INCLUDE = /usr/local/include/OpenCV
    CV11_LIB = /usr/local/lib/OpenCV
    CV22_INCLUDE = /usr/local/include/OpenCV2.2
    CV22_LIB = /usr/local/lib/OpenCV2.2
    }

    i think i should replace this for something like:

    CV22_INCLUDE = C:/OpenCV2.2/modules
    CV22_LIB = C:/OpenCV2.2/build/bin

    but with the correct pathways because i'm working on windows.
    When i open C:/Programming/openCV to search for similar directories, i can easily find the modules and build directories. but inside the build there's no bin folder (please see the attached image to see the folders i have in the build folder). i tried to set this paths to:

    CV22_INCLUDE = C:/Programming/openCV/modules
    CV22_LIB = C:/Programming/openCV/build/x86/mingw/bin

    is this the correct approach?

    at this point i tried to run the program and i still have the same error about not finding cv.h

    i figure i need to change some more things in the .pro file. changing:

    contains(cv,2){
    message(build with opencv 2.2)
    DEFINES += OPEN_CV_22
    INCLUDEPATH += $$CV22_INCLUDE/core/include/opencv2/core \
    $$CV22_INCLUDE/highgui/include/opencv2/highgui \
    $$CV22_INCLUDE/imgproc/include/opencv2/imgproc \
    $$CV22_INCLUDE/core/include \
    $$CV22_INCLUDE/imgproc/include
    LIBS += -L$$CV22_LIB
    LIBS += -lopencv_highgui220 -lopencv_core220 -lopencv_imgproc220
    } else{
    message(build with opencv 1.1)
    DEFINES -= OPEN_CV_22
    INCLUDEPATH += $$CV11_INCLUDE/cv/include $$CV11_INCLUDE/otherlibs/highgui $$CV11_INCLUDE/cxcore/include
    LIBS += -L$$CV11_LIB
    LIBS += -lcv -lhighgui -lcxcore
    }

    to:

    contains(cv,2){
    message(build with opencv 2.2)
    DEFINES += OPEN_CV_22
    INCLUDEPATH += $$CV22_INCLUDE/core/include/opencv2/core \
    $$CV22_INCLUDE/highgui/include/opencv2/highgui \
    $$CV22_INCLUDE/imgproc/include/opencv2/imgproc \
    $$CV22_INCLUDE/core/include \
    $$CV22_INCLUDE/imgproc/include
    LIBS += -L$$CV22_LIB
    LIBS += -llibopencv_highgui231 -llibopencv_core231 -llibopencv_imgproc231
    } else{
    message(build with opencv 1.1)
    DEFINES -= OPEN_CV_22
    INCLUDEPATH += $$CV11_INCLUDE/cv/include $$CV11_INCLUDE/otherlibs/highgui $$CV11_INCLUDE/cxcore/include
    LIBS += -L$$CV11_LIB
    LIBS += -lcv -lhighgui -lcxcore
    }

    (i browsed all the folders for the INCLUDEPATH variable and everything made sense, and in the LIBS variable, since this version is different from 2.2.0, names changed)

    i run the program again and again i find the same error. no cv.h found.

    i'm starting to think that the system PATH is wrong but i have no ideas.. what am i doing wrong?

    :S
    Attached Images Attached Images

  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 2.3.1 + QtSDK 1.1.3

    i'm starting to think that the system PATH is wrong but i have no ideas.. what am i doing wrong?
    Try to hard code every path you can - I think my .pro file is way too complicated.
    Get rid of the CV_22.. CV_11.. variables and just hard code the path to the opencv header files in INCLUDEPATH.
    ...
    INCLUDEPATH += C:/ProgramFiles/orWhateverElse/pathToAFolder/WithCv/H
    ...

  3. #3
    Join Date
    Oct 2011
    Location
    Porto, Portugal
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: opencv 2.3.1 + QtSDK 1.1.3

    well i tried to replace all the code with the CV_* variables for this:

    INCLUDEPATH += C:/Programming/openCV/modules

    LIBS += C:/Programming/openCV/build/x86/mingw/bin
    LIBS += -llibopencv_highgui231 -llibopencv_core231 -llibopencv_imgproc231

    but i still have the same error message:

    C:\Programming\Qt\SDK\workspace\QtCvExample\src\h\ ImageCapture.h:16: error: C1083: Cannot open include file: 'cv.h': No such file or directory

    seems that every change i make to the .pro file is useless..

  4. #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 2.3.1 + QtSDK 1.1.3

    Is the "cv.h" file present in "C:/Programming/openCV/modules" ?

  5. #5
    Join Date
    Oct 2011
    Location
    Porto, Portugal
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: opencv 2.3.1 + QtSDK 1.1.3

    no, it is not. i can only find the cv.h in either

    C:\Programming\openCV\build\include\opencv

    or

    C:\Programming\openCV\include\opencv

  6. #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 2.3.1 + QtSDK 1.1.3

    Great, so alter the INCLUDEPATH variable with correct values.

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

    rodolfo.marques (23rd October 2011)

  8. #7
    Join Date
    Oct 2011
    Location
    Porto, Portugal
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: opencv 2.3.1 + QtSDK 1.1.3

    well, after trying what you said, i still found another error which was not finding the "opencv2" folder inside the INCLUDEPATH.

    i figured this would be an installation problem, so i reinstalled QtSDK.
    meanwhile i also found a new tutorial here. Well i managed to follow this tutorial easily. but, when i got to the last part, i needed to make a few changes and i still don't get the example working.

    in the last step in the .pro file instead of using the path that is proposed in the tutorial i needed to use the libs from the original openCV folder (before compiling with Cmake). this was because i could not find any libs in the compiled folder. i found the folder they talk about and inside the .dll files exist, but with two differences: first they are called "libopencv_..." and second they all are "*.dll.a".

    i've seen in other examples that people add the .dll files instead of .lib files. what's the difference? when i try to compile and run my examples i get the error of not finding the .lib files?

    and when i compile with the actual .lib files, i don't get the image as suposed. only a cmd window saying "press anything to exit". why does this happen?

    thank you and i'm sorry for the trouble

  9. #8
    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 2.3.1 + QtSDK 1.1.3

    and when i compile with the actual .lib files, i don't get the image as suposed. only a cmd window saying "press anything to exit". why does this happen?
    I don't know, but I can provide you with some general tips.

    In order to use additional library with C++/C project, typically you need to have:
    A) header files
    B) compiled library files

    Next, when developing your project:
    1) during compilation phase, you have to provide compiler with info on how to find the headers from (A), Qt does that for you - you only need to care about INCLUDPATH variable in .pro file
    2) for the linker, you have to provide info on how to find the files from (B) and what type of linkage should be used (see below), Qt does that for you as well - via the LIBS variable

    what's the difference?
    Search for info on "static and dynamic linking".

    OpenCV is no different than any other library you want to add to your project, just make sure you provide correct info for steps (1) and (2).
    For the rest of your post, I won't solve it for you, you will benefit more by doing this yourself.

  10. #9
    Join Date
    Oct 2011
    Location
    Porto, Portugal
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: opencv 2.3.1 + QtSDK 1.1.3

    hello again!

    well i've had to work with some other things so i got a little bit delayed in this setting up!!

    i decided to start it all over again because of the bad results i was having and what i did (and it seems to work) was:

    download and install Qt SDK, download and install Cmake and download and extract opencv. i'm also trying to work with the kinect sensor so i also have all the drivers and openNI modules installed.

    i opened cmake gui and configured openCV for openni and qt. i noticed that cmake does NOT recognize a path for the qmake.exe file. i searched online and the path everyone talks about is “C:\<Qt_directory>\qt\bin\qmake.exe”

    my first problem: the directory does not exist. i searched for the file on the installation folder and got it in the bin directories of each module (Desktop, Simulator, madde, Symbian). which one should i use?

    i tried desktop and simulator because since i'm working with the kinect i though the others didn't make sense. they both work for the configure and generate in cmake. but when i try to do "mingw32-make" on the built directory it gets a lot of warnings and eventually stops with errors. any thoughts on why i cannot do the make comand?

    i'm following this tutorial:
    http://knowtheabc.wordpress.com/2011...nd-qt-creator/

Similar Threads

  1. Using QtSDk with Mysql 64bit
    By cia.michele in forum Installation and Deployment
    Replies: 0
    Last Post: 29th August 2011, 13:59
  2. SQL Driver for QTSDK 4.7.3
    By rivci in forum Newbie
    Replies: 3
    Last Post: 17th June 2011, 05:40
  3. qwtplot3d with qtsdk
    By bss in forum Qwt
    Replies: 1
    Last Post: 1st June 2011, 13:19
  4. Problem in QtSDK
    By c_srikanth1984 in forum Qt Tools
    Replies: 3
    Last Post: 6th April 2009, 05:16
  5. new with qtsdk x windows
    By Ricardo_arg in forum Newbie
    Replies: 2
    Last Post: 25th March 2009, 16:25

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.