OpenCV and QT Creator

Adding openCV to an QtCreator .pro file is easy in Linux simply add

CONFIG += link_pkgconfig
PKGCONFIG += opencv

to the .pro file.

In windows you need to hard code in the directories. To make it cross platform add

win32{
INCLUDEPATH += C:\opencv\opencv\build\include
LIBS += -LC:\\opencv\\build\\bin \
libopencv_core2411 \
libopencv_highgui2411 \
libopencv_imgproc2411 \
libopencv_features2d2411 \
libopencv_calib3d2411 \
libopencv_contrib2411 \
libopencv_video2411 \
}
unix{
CONFIG += link_pkgconfig
PKGCONFIG += opencv
}

 

but change the windows library names and locations to suit yourself.