- 使用Homebrew安装 OpenCV 4
brew install opencv
- 进入安装目录
cd /usr/local/Cellar/opencv
- 首先检查Apache Ant有没有安装,没有的话就用homebrew安装:
brew install ant
- 编辑homebrew的opencv formula:
brew edit opencv
- 找到这一行:-DBUILD_opencv_java=OFF 改为 -DBUILD_opencv_java=ON,就可以编译下载opencv了:
brew reinstall --build-from-source opencv
- 执行完之后等待即可