Cmake
- 管理员身份打开Cmake_gui,source文件夹选择 OpenCV_3.4.3\sources
- to build文件夹选择一个空文件夹
- 单击Configure,等待 generate done
添加contrib部分
-
找到OPENCV_EXTRA_MODULES_PATH,在右侧输入 contrib/modules 目录
-
点击 configure,等待 configuring done
-
点击 generate,等待 generating done
-
点击 open project,跳到vs2015中
VS2015中生成
- 选择环境debug x64 和 release x64,分别重新生成解决方案,这部分耗时较长,约10min
- 重新生成完成后,在解决方案下面找到CMake Targets目录下的install文件,右键->仅用于项目->仅重新生成install,等待成功
- 注意:debug x64 和 release x64都要走1,2步
配置系统环境变量和VS2015目录
- 文件管理器,此电脑上右键->属性->高级系统设置->环境变量
- 在用户环境变量 path 后添加一个值,位置为:cmake编译时选择的build目录/install/x64/vc14/bin
- VS中新建一个工程,在属性管理器中,对 debug x64 和 release x64,分别右键->属性
- 在vc++目录->包含目录里,添加 build目录/install/include、build目录/install/include/opencv、build目录/install/include/opencv2 三条目录
- 在vc++目录->库目录里,添加 build目录/install/x64/vc14/lib 目录
- 在链接器->输入->附加依赖项中,添加 build目录/install/x64/cv14/lib 下的所有文件
附加依赖项添加文件列表
debug x64
opencv_aruco343d.lib
opencv_bgsegm343d.lib
opencv_bioinspired343d.lib
opencv_calib3d343d.lib
opencv_ccalib343d.lib
opencv_core343d.lib
opencv_datasets343d.lib
opencv_dnn_objdetect343d.lib
opencv_dnn343d.lib
opencv_dpm343d.lib
opencv_face343d.lib
opencv_features2d343d.lib
opencv_flann343d.lib
opencv_fuzzy343d.lib
opencv_hfs343d.lib
opencv_highgui343d.lib
opencv_img_hash343d.lib
opencv_imgcodecs343d.lib
opencv_imgproc343d.lib
opencv_line_descriptor343d.lib
opencv_ml343d.lib
opencv_objdetect343d.lib
opencv_optflow343d.lib
opencv_phase_unwrapping343d.lib
opencv_photo343d.lib
opencv_plot343d.lib
opencv_reg343d.lib
opencv_rgbd343d.lib
opencv_saliency343d.lib
opencv_shape343d.lib
opencv_stereo343d.lib
opencv_stitching343d.lib
opencv_structured_light343d.lib
opencv_superres343d.lib
opencv_surface_matching343d.lib
opencv_text343d.lib
opencv_tracking343d.lib
opencv_video343d.lib
opencv_videoio343d.lib
opencv_videostab343d.lib
opencv_xfeatures2d343d.lib
opencv_ximgproc343d.lib
opencv_xobjdetect343d.lib
opencv_xphoto343d.lib
release x64
opencv_aruco343.lib
opencv_bgsegm343.lib
opencv_bioinspired343.lib
opencv_calib3d343.lib
opencv_ccalib343.lib
opencv_core343.lib
opencv_datasets343.lib
opencv_dnn_objdetect343.lib
opencv_dnn343.lib
opencv_dpm343.lib
opencv_face343.lib
opencv_features2d343.lib
opencv_flann343.lib
opencv_fuzzy343.lib
opencv_hfs343.lib
opencv_highgui343.lib
opencv_img_hash343.lib
opencv_imgcodecs343.lib
opencv_imgproc343.lib
opencv_line_descriptor343.lib
opencv_ml343.lib
opencv_objdetect343.lib
opencv_optflow343.lib
opencv_phase_unwrapping343.lib
opencv_photo343.lib
opencv_plot343.lib
opencv_reg343.lib
opencv_rgbd343.lib
opencv_saliency343.lib
opencv_shape343.lib
opencv_stereo343.lib
opencv_stitching343.lib
opencv_structured_light343.lib
opencv_superres343.lib
opencv_surface_matching343.lib
opencv_text343.lib
opencv_tracking343.lib
opencv_video343.lib
opencv_videoio343.lib
opencv_videostab343.lib
opencv_xfeatures2d343.lib
opencv_ximgproc343.lib
opencv_xobjdetect343.lib
opencv_xphoto343.lib