0、下載opencv-4.2.0-vc14_vc15.exe 和 opencv_contrib-4.2.0.zip 並解壓git
一、打開CMake gui軟件,配置路徑github
二、點擊 Configure,設置以下ide
三、CMake界面顯示紅色,ui
再次點擊Configure,直至CMake界面顯示白色3d
四、CMake界面找到 OPENCV_EXTRA_MODULES_PATH,設置opencv_contrib-4.2.0所在目錄code
再次點擊Configure,報錯。查看提示信息,發現一些文件沒法下載。blog
直接在這個網頁裏搜索 BenbenIO 這個用戶的回答ip
或者執行如下操做get
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_win_intel64_20180723_general.zip 二、修更名稱爲 1d222685246896fe089f88b8858e4b2f-ippicv_2019_win_intel64_20180723_general.zip 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\ippicv
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/a66a24e9f410ae05da4baeeb8b451912664ce49c/ffmpeg/opencv_videoio_ffmpeg.dll 二、修更名稱爲 5de6044cad9398549e57bc46fc13908d-opencv_videoio_ffmpeg.dll 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\ffmpeg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/a66a24e9f410ae05da4baeeb8b451912664ce49c/ffmpeg/opencv_videoio_ffmpeg_64.dll 二、修更名稱爲 5de6044cad9398549e57bc46fc13908d-opencv_videoio_ffmpeg.dll 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\ffmpeg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/a66a24e9f410ae05da4baeeb8b451912664ce49c/ffmpeg/ffmpeg_version.cmake 二、修更名稱爲 5de6044cad9398549e57bc46fc13908d-opencv_videoio_ffmpeg.dll 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\ffmpeg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/a66a24e9f410ae05da4baeeb8b451912664ce49c/ffmpeg/ffmpeg_version.cmake 二、修更名稱爲 ad57c038ba34b868277ccbe6dd0f9602-ffmpeg_version.cmake 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\ffmpeg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i 二、修更名稱爲 0ea90e7a8f3f7876d450e4149c97c74f-boostdesc_bgm.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載 https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i 二、修更名稱爲 34e4206aef44d50e6bbcd0ab06354b52e7466d26-boostdesc_bgm_bi.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載 https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_hd.i 二、修更名稱爲 34e4206aef44d50e6bbcd0ab06354b52e7466d26-boostdesc_bgm_hd.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_064.i 二、修更名稱爲 34e4206aef44d50e6bbcd0ab06354b52e7466d26-boostdesc_binboost_064.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_128.i 二、修更名稱爲 34e4206aef44d50e6bbcd0ab06354b52e7466d26-boostdesc_binboost_128.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_256.i 二、修更名稱爲 34e4206aef44d50e6bbcd0ab06354b52e7466d26-boostdesc_binboost_256.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_lbgm.i 二、修更名稱爲 34e4206aef44d50e6bbcd0ab06354b52e7466d26-boostdesc_lbgm.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\boostdesc
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_48.i 二、修更名稱爲 fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d-vgg_generated_48.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\vgg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_64.i 二、修更名稱爲 fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d-vgg_generated_64.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\vgg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_80.i 二、修更名稱爲 fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d-vgg_generated_80.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\vgg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_120.i 二、修更名稱爲 fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d-vgg_generated_120.i 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\xfeatures2d\vgg
一、下載https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat 二、修更名稱爲 8afa57abc8229d611c4937165d20e2a2d9fc5a12-face_landmark_model.dat 三、存放到目錄 D:\Software\Programming Software\OpenCV\opencv 4.2.0\opencv\sources\.cache\data
再次點擊Configure,沒有報錯。點擊Generate。源碼
打開OpenCV.sln,選擇CMakeTargets裏面INSTALL, 生成。