These days, I am learning OpenCV and Qt programming for my undergraduate project. So, I thought to share my knowledge with you all.
I was struggling a lot to link both OpenCV and Qt as a beginner. Finally, I found these posts which are great.
This is how my project's .pro file looks... (OS - Windows 7)
INCLUDEPATH += "C:\OpenCV2.1\include\opencv" \
"C:\OpenCV2.1\src\cv" \
"C:\OpenCV2.1\src\cvaux" \
"C:\OpenCV2.1\src\cxcore" \
"C:\OpenCV2.1\src\highgui" \
"C:\OpenCV2.1\src\ml"
LIBS += -L"C:\OpenCV2.1\lib" \
-lcv210 \
-lcvaux210 \
-lhighgui210 \
-lcxcore210
Here cv210, cvaux210 and so on..... are the names of lib files in your opencv lib folder.
Very simple thing... but as a beginner, I know how I struggled with this.. So, this post is for those who are new to OpenCv with Qt Programming.
Have a nice day!!! :)
Thanks for sharing. It is almost the same under Linux. Following line solved my problem:
ReplyDeleteLIBS += -lcv -lhighgui -lfftw3
except that I don't have to tell the include path, it is managed by Ubuntu. Just install the package using package manager and you're done.
Thanks for your information also.
ReplyDeletereally had a little hard time finding =x
ReplyDeleteWorks like a charm thanks ^^
For example you can use pkg-config.
ReplyDeleteIt will be look like this:
CONFIG += link_pkgconfig
PKGCONFIG += opencv
Alex, I didn't get you. You meant instead of giving include and library paths, we can just give only pkg-config ??
ReplyDelete