mac10.12.6系统使用cmake安装opencv3.3.0+opencv_contrib-3.3.0
brew与cmake
brew安装
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew卸载
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
cmake安装
brew install cmake
下载相关源码包
- opencv-3.3.0:下载的是source源码
- opencv_contrib-3.3.0 :直接下载zip压缩包
cmake生成makefile、编译、安装
cd opencv-3.3.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/Users/xx/Downloads/opencv_contrib-3.3.0/modules ..
make -j16 # 16线程编译
sudo make install # 安装
安装在/usr/local/lib
以及/usr/local/include/opencv2
参考
1