2 Temmuz 2017 Pazar

OpenCV Installation on Ubuntu 16.04 and Integration with Qt

OpenCV Installation on Ubuntu 16.04 and Integration with Qt 


Step 1: Download latest version of OpenCV (OpenCV 3.2.0 is downloaded for this installation)


Step 2: "opencv-3.2.0" folder is extracted from downloaded "opencv-3.2.0.zip".


Step 3: Extracted folder contains sub-folders and files as seen following image. 2 folders named "source" and "build" are created and then all these sub-folders and files are cut and copied to the "source" folder. At this stage, "build" folder remains empty.




 
Step 4: If you do not have Cmake-GUI, you can install it using following code.

sudo apt install cmake-gui


Step 5: Open Cmake-GUI and define your "build" and "source" folders path like following image. Then click "Configure" button.



Step 6: After configuration done, select "WITH_QT" property "ON". 



Step 7: Click "Generate" button and wait until seeing "Generating done" message.


Note: You may encounter following error.



You can solve this issue writing following code.


sudo apt-get install qt5-default




Step 8: Open terminal and go to "build" folder and run following code to complete installation.


sudo make install


 

Step 9: In order to use your OpenCV libraries in Qt Creator, you only need to define OpenCV libraries path in the project (.pro) file as seen following image.


INCLUDEPATH += /home/eyyup/Downloads/opencv-3.2.0/build/include
LIBS += -L"/home/eyyup/Downloads/opencv-3.2.0/build/lib"
LIBS += -lopencv_calib3d
LIBS += -lopencv_core
LIBS += -lopencv_features2d
LIBS += -lopencv_flann
LIBS += -lopencv_highgui
LIBS += -lopencv_imgcodecs
LIBS += -lopencv_imgproc
LIBS += -lopencv_ml
LIBS += -lopencv_objdetect
LIBS += -lopencv_photo
LIBS += -lopencv_shape
LIBS += -lopencv_stitching
LIBS += -lopencv_superres
LIBS += -lopencv_video
LIBS += -lopencv_videoio
LIBS += -lopencv_videostab 




Hiç yorum yok:

Yorum Gönder