Mac 上 安装opencv3

本文大部分翻译与:http://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/

当你在mac上安装上opencv后,生活立即美好起来。那我们机开始吧。

  1. 在macosx上安装opencv2
brew tap homebrew/science
brew install opencv
  1. 在macosx上安装opencv3
brew tap homebrew/science
brew install opencv3

当然我们也可以有不同的选择,比如可以安装额外的模块 contrib cuda等

# Easy install for beginners
brew install opencv3 --with-contrib 
# For intermediate and advanced users. 
brew install opencv3 --with-contrib --with-cuda --with-ffmpeg --with-tbb --with-qt5

opencv3 brew install options

--32-bit
    Build 32-bit only
--c++11
    Build using C++11 mode
--with-contrib
    Build "extra" contributed modules
--with-cuda
    Build with CUDA v7.0+ support
--with-ffmpeg
    Build with ffmpeg support
--with-gphoto2
    Build with gphoto2 support
--with-gstreamer
    Build with gstreamer support
--with-jasper
    Build with jasper support
--with-java
    Build with Java support
--with-libdc1394
    Build with libdc1394 support
--with-opengl
    Build with OpenGL support (must use --with-qt5)
--with-openni
    Build with openni support
--with-openni2
    Build with openni2 support
--with-python3
    Build with python3 support
--with-qt
    Build the Qt4 backend to HighGUI
--with-qt5
    Build the Qt5 backend to HighGUI
--with-quicktime
    Use QuickTime for Video I/O instead of QTKit
--with-tbb
    Enable parallel code in OpenCV using Intel TBB
--without-eigen
    Build without eigen support
--without-numpy
    Use a numpy you've installed yourself instead of a Homebrew-packaged numpy
--without-opencl
    Disable GPU code in OpenCV using OpenCL
--without-openexr
    Build without openexr support
--without-python
    Build without Python support
--without-tests
    Build without accuracy & performance tests
--HEAD
    Install HEAD version
  1. 使用源码安装opencv3
    4.1 下载opencv3
    https://github.com/Itseez/opencv/archive/3.0.0.zip
    也可以使用git
git clone https://github.com/Itseez/opencv.git
cd opencv 
git checkout tags/3.0.0

4.2 配置CMAKE

cd /path/to/opencv
mkdir build

4.3 with opencv_contrib

git clone https://github.com/Itseez/opencv_contrib.git
cd opencv_contrib
git checkout tags/3.0.0

4.4 配置

cmake -D OPENCV_EXTRA_MODULES_PATH=full/path/to/opencv_contrib/modules -D WITH_CUDA=OFF -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=RELEASE   ..

4.5 build opencv

make
make install

你可能感兴趣的:(opencv)