【OpenCV】Qt5 中使用OpenCV 3.4.2


在 Qt5 中使用 OpenCV 时,经常会遇到一些构建错误,本方法专治以下构建错误:

【OpenCV】Qt5 中使用OpenCV 3.4.2_第1张图片


1、在工程文件 .pro 末尾加入:

macx{
INCLUDEPATH += /usr/local/opt/opencv@3/include
LIBS += -L/usr/local/Cellar/opencv/3.4.2/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_face -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core
}

2、清理项目;

3、执行“qmake”;

4、构建项目;

5、运行。

 


 

你可能感兴趣的:(OpenCV,Qt)