PDA

View Full Version : OpenCV 2.3.1 Integration



Aerowrx
20th February 2012, 07:37
Followed these directions to integrate the new OpenCV:
http://www.barbato.us/2011/12/20/opencv-2-3-qtcreator-windows/

However, i'm getting errors
7415



#include <iostream>
#include <opencv2/opencv.hpp>
//#include <opencv2/highgui/highgui.hpp>
//#include <opencv2/core/core.hpp>
#include <opencv/cv.h>
#include <opencv/highgui.h>

using namespace cv;

int main(int, char**)
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;

// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}

ChrisW67
20th February 2012, 08:01
Assuming you are using qmake (because otherwise nothing you posted here or here has anything to do with Qt) you need to fix the contents of your pro file LIBS variable to direct the linker to link the OpenCV librairy(-ies). See Declaring other libraries in the qmake manual.

Aerowrx
20th February 2012, 10:50
I successfully got rid of all compiling errors by using this mingw include method. However, when I run any type of OpenCV example code nothing happens. I just get
the black DOS window that says "Press <ENTER> to Closed this Window." There are also no errors in the QT Creator Application Output or the Compile Output but all the example codes just result in QT exiting with "code 0" in the output.


INCLUDEPATH += C:\opencv\build\include \

LIBS += C:\opencv\build\x86\mingw\lib\libopencv_calib3d231 .dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_contrib231 .dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_core231.dl l.a \
C:\opencv\build\x86\mingw\lib\libopencv_features2d 231.dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_flann231.d ll.a \
C:\opencv\build\x86\mingw\lib\libopencv_gpu231.dll .a \
C:\opencv\build\x86\mingw\lib\libopencv_highgui231 .dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_imgproc231 .dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_legacy231. dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_ml231.dll. a \
C:\opencv\build\x86\mingw\lib\libopencv_objdetect2 31.dll.a \
C:\opencv\build\x86\mingw\lib\libopencv_video231.d ll.a \



In my main.cpp file I have included these files below, however If i attempt to use Mat img = imread("file) at all I get whole bunch of CV related errors.
7419



#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>