首頁 > 軟體

Windows環境下編譯OpenCV3.0和OpenCV_contrib

2020-06-16 17:33:57

一、下載安裝

下載以上內容並安裝opencv和cmake-gui,我的OpenCV安裝路徑為D:opencv3

二、使用cmake生成OpenCV.sln

  1. 開啟cmake-gui

  2. 在where is the source code選擇opencv的安裝目錄,我的是D:opencv3opencvsources

  3. 在where to build the binaries裡面選擇要將opencv編譯到的目錄下面,我的是:D:opencv3opencvmybuild

  4. 點選configure,在彈出的對話方塊內選擇 Visual Studio 2013和default引數,點選finish。

  5. 這個時候cmake會開始編譯不知道什麼東西,然後會在螢幕中間出現一堆引數包括Name和Value,在其中找到Name為OPENCVEXTRAMODULESPATH的引數,然後把它的Value設定為opencvcontrib的路徑,我的是D:/Files/Codes/Tracking/Exp/opencvcontrib-master/opencvcontrib-master/modules

  6. 然後點選Generate,等待。中間報了兩次錯,我去掉了BUILDopencvadas和WITH_CUDA等一系列看起來沒用的東西,然後就完成了。

三、用VS編譯生成debug和release庫

  1. 開啟D:opencv3opencvmybuild目錄下的OpenCV.sln

  2. 編譯debug版本庫:在“解決方案'OpenCV'(141個專案)”上面點選右鍵-->重新生成解決方案。

  3. 找到CMakeTargets中的INSTALL,然後右鍵選擇“僅限於專案”-->“僅生成INSTALL”,然後就在D:opencv3opencvmybuildinstall中發現了許多東東。

四、重新設定自己的專案

  1. VC++目錄-->包含目錄,新增:
    D:opencv3opencvmybuildinstallinclude

  2. VC++目錄-->庫目錄,新增:
    D:opencv3opencvmybuildinstallx86vc12lib
    D:opencv3opencvmybuildinstallx86vc12staticlib

  3. 連結器-->輸入-->附加依賴項,新增:

opencv_bgsegm300d.lib
opencv_bioinspired300d.lib
opencv_calib3d300d.lib
opencv_ccalib300d.lib
opencv_core300d.lib
opencv_datasets300d.lib
opencv_face300d.lib
opencv_features2d300d.lib
opencv_flann300d.lib
opencv_hal300d.lib
opencv_highgui300d.lib
opencv_imgcodecs300d.lib
opencv_imgproc300d.lib
opencv_latentsvm300d.lib
opencvlinedescriptor300d.lib
opencv_ml300d.lib
opencv_objdetect300d.lib
opencv_optflow300d.lib
opencv_photo300d.lib
opencv_reg300d.lib
opencv_rgbd300d.lib
opencv_saliency300d.lib
opencv_shape300d.lib
opencv_stereo300d.lib
opencv_stitching300d.lib
opencv_superres300d.lib
opencvsurfacematching300d.lib
opencv_text300d.lib
opencv_tracking300d.lib
opencv_ts300d.lib
opencv_video300d.lib
opencv_videoio300d.lib
opencv_videostab300d.lib
opencv_xfeatures2d300d.lib
opencv_ximgproc300d.lib
opencv_xobjdetect300d.lib
opencv_xphoto300d.lib
ippicvmt.lib

OpenCV官方教學中文版(For Python) PDF  http://www.linuxidc.com/Linux/2015-08/121400.htm

Ubuntu Linux下安裝OpenCV2.4.1所需包 http://www.linuxidc.com/Linux/2012-08/68184.htm

Ubuntu 12.04 安裝 OpenCV2.4.2 http://www.linuxidc.com/Linux/2012-09/70158.htm

CentOS下OpenCV無法讀取視訊檔 http://www.linuxidc.com/Linux/2011-07/39295.htm

Ubuntu 12.04下安裝OpenCV 2.4.5總結 http://www.linuxidc.com/Linux/2013-06/86704.htm

Ubuntu 10.04中安裝OpenCv2.1九步曲 http://www.linuxidc.com/Linux/2010-09/28678.htm

基於QT和OpenCV的臉部辨識系統 http://www.linuxidc.com/Linux/2011-11/47806.htm


IT145.com E-mail:sddin#qq.com