在mac下用cmake安装opencv

依赖

  • CMake 3.9 or higher
  • Git
  • Python 2.7 or later and Numpy 1.5 or later

CMAKE

通过cmake-gui安装

  • 设置OpenCV源码路径
  • 设置CMake build路径
  • 运行 Configure
  • 运行 Generate
  • 到build目录的命令行中 运行 make -j7

一些设置

  • build type: CMAKE_BUILD_TYPE=Release (or Debug)
  • to build with modules from opencv_contrib set OPENCV_EXTRA_MODULES_PATH to /modules(扩展模块可选)
  • set BUILD_DOCS=ON for building documents (doxygen is required)
  • set BUILD_EXAMPLES=ON to build all examples