Opencv and Qt integration

I found two good websites which they explain OpenCV and Qt integration. Here is a website that explain OpenCV installation well.  And another website  explains more about QT side. You may face two problem if you follow these two websites.

1 ) When you follow the first website steps change the “-D WITH_QT=ON” to “-D WITH_QT=OFF”. Then you will not have a problem.

2 ) Another change you need to do is for the second website. In the website, it is saying that we need to add this lines to .pro file.

INCLUDEPATH += `pkg-config --cflags opencv`
LIBS += `pkg-config —libs opencv`

Actually it did not work for me. So instead of those two lines I added the code below. :

INCLUDEPATH += /usr/local/include/opencv \
/usr/local/include/opencv2

LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann

Then it works fine.  One more quick detail if you add the code below to .pro file you will not see .moc and .obj files in the directory.

OBJECTS_DIR = .obj
MOC_DIR = .moc

I hope this  information helps you. Good bye.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s