找回密码
 立即注册
查看: 254|回复: 0

mac安装opencv

[复制链接]
发表于 2022-6-11 10:43 | 显示全部楼层 |阅读模式
我的系统是macOS Catalina,安装opencv步骤如下,参考文档https://blog.csdn.net/lifetragedy/article/details/123459339:
    vi ~/.zshrc,加入:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottlesexport SSL_CERT_DIR="/usr/local/etc/openssl/certs"export SSL_CERT_FILE="/usr/local/etc/openssl/cert.pem"
brew源可以选择https://mirrors.ustc.edu.cn/homebrew-bottles或https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
    执行source ~/.zshrc执行brew update执行brew edit opencv,把-DBUILD_opencv_java=OFF 修改为-DBUILD_opencv_java=ON安装JAVAbrew install openjdk,会安装java18在~/.zshrc加入java18的JAVA_HOME环境变量export JAVA_HOME=/usr/local/Cellar/openjdk/18执行brew install ant
  • 执行brew install --build-from-source opencv
    可能会卡在安装依赖
    ==> Installing dependencies for opencv: nettle, p11-kit,....,报错Error: No such file or directory @ rb_sysopen
    解决方法:把那些依赖复制下来去掉逗号,用brew install 单独安装一次,如:
    brew install nettle p11-kit libevent libnghttp2 unbound gnutls lame libass libbluray cjson cmocka mbedtls librist libsoxr libvidstab libogg libvorbis libvpx opencore-amr opus rav1e flac libsndfile libsamplerate rubberband sdl2 snappy speex srt libarchive tesseract theora x264 x265 xvid libsodium zeromq zimg ffmpeg@4 numpy protobuf boost gl2ps glew libaec hdf5 jsoncpp netcdf pugixml pyqt@5 utf8cpp vtk
    然后再执行:brew install --build-from-source opencv查看安装目录:/usr/local/Cellar/opencv/4.5.5,安装成功将/usr/local/share/java/opencv4/libopencv_java454.dylib文件拷贝到jdk的lib目录下
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-26 17:38 , Processed in 0.147906 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表