Opencv3.x安装教程 mac

Opencv3.2.0安装为例

一、下载opencv3.2.0

链接:https://opencv.org/opencv-3-2.html

二、下载opencv_contrib

链接:https://github.com/opencv/opencv_contrib

三、下载cmake

链接:http://mac.softpedia.com/get/Development/Compilers/CMake.shtml
Opencv3.x安装教程 mac_第1张图片

四、配置cmake

1、打开cmake
2、 在where is the source code中写入opencv目录

/Users/LXJ/Downloads/opencv-3.2.0

在where to build the binaries中填入

/Users/LXJ/Downloads/opencv-3.2.0/release

点击configure

Opencv3.x安装教程 mac_第2张图片

选择unix makefile,其他默认。

在Search中输入extra,选中OPENCV_EXTRA_MODULES_PATH,   

在value中输入opencv_contrib_master库的modules路径

再次点击configure,完成配置。

过程中遇到的问题:

CMake Error at /Users/LXJ/Downloads/opencv-3.2.0/cmake/OpenCVUtils.cmake:1043 (file):
file DOWNLOAD cannot open file for write.
Call Stack (most recent call first):
/Users/LXJ/Downloads/opencv_contrib-master/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
/Users/LXJ/Downloads/opencv_contrib-master/modules/xfeatures2d/CMakeLists.txt:9 (download_vgg_descriptors)

CMake Error at /Users/LXJ/Downloads/opencv-3.2.0/cmake/OpenCVUtils.cmake:1047 (message):
Failed to download . Status=
Call Stack (most recent call first):
/Users/LXJ/Downloads/opencv_contrib-master/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
/Users/LXJ/Downloads/opencv_contrib-master/modules/xfeatures2d/CMakeLists.txt:9 (download_vgg_descriptors)


遇到以上类似问题ocv_download,解决方案如下:

1、在modules中找到对应文件,打开。

2、将FILENAME替换为PACKAGE,再次编译。

3、编译过程中,遇到问题,继续上述过程。

完成后,点击generate。

3、在终端中打开opencv3.2.0的release文件夹

cd /Users/LXJ/Downloads/opencv-3.2.0/release/

文件夹中生成makefile文件

4、终端中输入make完成编译


你可能感兴趣的:(opencv)