首先如果原本有删除过vs2015你会怎么都安不上所以需要先删除干净,先再应用那里将vs2015卸载然后会存在卸载不干净的文件存在,所以使用以下工具(如果电脑存在多个vs系统慎用,本人概不负责)
vs卸载工具 链接:https://pan.baidu.com/s/1kvo_vDnj8QXRuLhdWcvISg
提取码:fglf
管理员启动Setup.ForcedUninstall.exe 然后按y就行
然后去官网下vs2015 或者使用我下面提供了两个iso
链接:https://pan.baidu.com/s/1NiFg7V5D1tT1ojqnBIgVAg
提取码:gzfc
备用链接 链接:https://pan.baidu.com/s/1nTC0bMSFiGbf5lE3qdXpZg
提取码:z43z
Releases - OpenCV 然后去这个opencv官网下载你所需要的版本或者我已经配置好的opencv440
这个版本是opencv440的 链接:https://pan.baidu.com/s/1lKZ8CNfUqWiJfdLwOpXQfw
提取码:gp4r
然后在环境变量path中配置环境为:你opencv刚刚下载的位置\install\x64\vc14\bin,当然如果是从官网下的应该是:你opencv刚刚下载的位置\build\x64\vc14\bin,如果我这边是vs2015才选的vc14如果不是请选择你的vs版本相对应的vc其他下面的都一样
然后创建一个vs项目然后在debugx64下添加新项目属性表
然后在右键属性-》vc++目录-》包含目录-》编辑中添加
你opencv刚刚下载的位置\install\include
你opencv刚刚下载的位置\install\include\opencv2
如果你是官网下的应该是
你opencv刚刚下载的位置\build\include
你opencv刚刚下载的位置\build\include\opencv2
在右键属性-》vc++目录-》库目录-》编辑中添加
你opencv刚刚下载的位置\lib\Debug
你opencv刚刚下载的位置\install\x64\vc14\lib
如果你是官网下的应该是
你opencv刚刚下载的位置\build\x64\vc14\lib
在右键属性-》链接器-》输入-》附加依赖项-》编辑中添加
opencv_aruco440d.lib
opencv_bgsegm440d.lib
opencv_bioinspired440d.lib
opencv_calib3d440d.lib
opencv_ccalib440d.lib
opencv_core440d.lib
opencv_datasets440d.lib
opencv_dnn440d.lib
opencv_dnn_objdetect440d.lib
opencv_dnn_superres440d.lib
opencv_dpm440d.lib
opencv_face440d.lib
opencv_features2d440d.lib
opencv_flann440d.lib
opencv_fuzzy440d.lib
opencv_gapi440d.lib
opencv_hfs440d.lib
opencv_highgui440d.lib
opencv_imgcodecs440d.lib
opencv_imgproc440d.lib
opencv_img_hash440d.lib
opencv_intensity_transform440d.lib
opencv_line_descriptor440d.lib
opencv_ml440d.lib
opencv_objdetect440d.lib
opencv_optflow440d.lib
opencv_phase_unwrapping440d.lib
opencv_photo440d.lib
opencv_plot440d.lib
opencv_quality440d.lib
opencv_rapid440d.lib
opencv_reg440d.lib
opencv_rgbd440d.lib
opencv_saliency440d.lib
opencv_shape440d.lib
opencv_stereo440d.lib
opencv_stitching440d.lib
opencv_structured_light440d.lib
opencv_superres440d.lib
opencv_surface_matching440d.lib
opencv_text440d.lib
opencv_tracking440d.lib
opencv_video440d.lib
opencv_videoio440d.lib
opencv_videostab440d.lib
opencv_xfeatures2d440d.lib
opencv_ximgproc440d.lib
opencv_xobjdetect440d.lib
opencv_xphoto440d.lib
如果你是官网下的你就去你的 :你opencv刚刚下载的位置\build\x64\vc14\lib下所有lib文件给复制进去