安装MacPorts
- 应用商店安装XCode
- Xcode Command Line Tools的安装 xcode-select --install
- 证书允许 sudo xcodebuild -license
- 安装MacPorts
MacPorts的官网
下载地址
- 设置环境变量 cd ~ vi .bash_profile 添加如下两行 export PATH=/opt/local/bin:$PATH export PATH=/opt/local/sbin:$PATH 让配置生效 source .bash_profile
安装openCV
安装openCV java
代码语言:javascript复制sudo port selfupdate
sudo port install opencv java
号前有空格, 号后无空格。
若中途出现错误如下:
Error: Failed to build db48: command execution failed
则输入以下命令删除,再重新进行安装db48后,再安装opencv
代码语言:javascript复制sudo port clean db48
sudo port install db48
安装确认
代码语言:javascript复制port contents opencv | grep java
出现以下信息代表安装完成:
代码语言:javascript复制/opt/local/share/OpenCV/java/libopencv_java343.dylib
/opt/local/share/OpenCV/java/opencv-343.jar
Brew安装openCV
代码语言:javascript复制/usr/local/Cellar/opencv/3.4.3
Idea配置
项目右键–>Open Module Settings–>Libratries–>加号–>Java–>/opt/local/share/OpenCV/java/
–>OK
Tomcat8 VM options 配置如下
代码语言:javascript复制-Djava.library.path=/opt/local/share/OpenCV/java/