PDA

View Full Version : qt is not able to locate header files of opencv



komal1991
15th November 2011, 10:29
hello people
I m new to qt and opencv. from the last 24 hours i m trying to link qt with opencv. i have read all the related posts on this forum. but nothing worked out. plz someone help me.
plz tell me why qt is not able to locate the header files of opencv.

the procedure i adopted is given as follows:
1. downloaded opencv 2.3.1, qtsdk 4.7.4 and cmake 2.8.
2. generated binary files of opencv by following the tutorial http://knowtheabc.wordpress.com/2011/02/25/windows-opencv-and-qt-creator/
3. initially i extracted opencv files in the folder named as "opencv" located at C:\Program Files\opencv. Then i
generated binary files in the folder named as "opencv_binary" located at C:\Program Files\opencv_binary.
4. when the binary files got generated i copied the folder "opencv_binary" in "opencv" itself.
5. now after writing the code i modified .pro file as follows:
i appended the following code to .pro file:
INCLUDEPATH += C:\Program Files\opencv\include\opencv\
LIBS += -LC:\Program Files\opencv\opencv_binary\lib\
-lopencv_core220 \
-lopencv_highgui220 \
-lopencv_imgproc220 \
-lopencv_features2d220 \
-lopencv_calib3d220
6. and the header files i am using are like this:
#include "cv.h"
#include "cvaux.h"
#include "highgui.h"
7. now when i build this project it says "no such file or directory exist".
8. Also i have changed the PATH variable to include C:\QtSDK\mingw\bin;C:\Program Files\opencv\opencv_binary\bin;

I don know whats wrong with these steps. someone please help. I am working on a final year project and have to submit it by the day after tomorrow. Its really urgent. Please HELP!!

Oleg
15th November 2011, 11:18
Try


INCLUDEPATH += "C:\Program Files\opencv\include\opencv"
LIBS += -L"C:\Program Files\opencv\opencv_binary\lib" \
-lopencv_core220 \
-lopencv_highgui220 \
-lopencv_imgproc220 \
-lopencv_features2d220 \
-lopencv_calib3d220

komal1991
15th November 2011, 11:59
I tried it but it din't work.
Plz giv some more suggestions..

Oleg
15th November 2011, 12:21
Actually it should work, if the paths are correct.
Have you rerun qmake after changing .pro?

komal1991
15th November 2011, 12:33
umm..i have rebuilt it. But i dint get what do u mean by "re-run qmake"

Oleg
15th November 2011, 12:45
After changing pro file you should run qmake again to have correct makefiles. Right click on your project and select "Run qmake".

komal1991
15th November 2011, 12:52
yes i followed it..but still it is not working

Oleg
15th November 2011, 13:36
OK, I can't say what is wrong, but having spaces in include/lib paths isn't good (although it should work with quotes). Try to move include dir to somewhere like c:\opencv, then change .pro file:


INCLUDEPATH += c:/opencv/include

and in your sources use:


#include <opencv/cv.h>
#include <opencv/cvaux.h>
#include <opencv/highgui.h>

It should find headers fine. At least it works for me in such way in my projects.

komal1991
15th November 2011, 14:14
thanx Oleg Shparber!
My problem is solved.