189 8069 5689

在Mac上配置OpenCV+QT-创新互联

1.安装Xcode

    from App Store

2.安装MacPorts(https://www.macports.org/install.php)

  注意系统版本,因为之前装错了版本,重装还导致了下面的问题

创新互联主营芮城网站建设的网络公司,主营网站建设方案,重庆APP软件开发,芮城h5成都小程序开发搭建,芮城网站营销推广欢迎芮城等地区企业咨询

  问题:Waiting for other installations to finish(参考:http://superuser.com/questions/169908/installer-hangs-on-waiting-for-other-installations-to-finish-despite-no-other)
  解决:Chances are that a previous installation hung and the lock was never cleaned up.
    1)sudo rm /private/var/db/mds/system/mds.install.lock
    2)  reboot
  记得更新下,有点慢。(https://trac.macports.org/ticket/43228):

  Terminal: sudo port selfupdate


3.安装CMake

  (http://www.cmake.org/download/)

之前有安装过但是失败了,说是没验证不能运行,重新安装了下还是有这个问题,调整了下mac的安全权限:

  (参考:http://www.native-instruments.com/en/support/knowledge-base/show/949/mac-os-10.8-error-message-...-cant-be-opened-because-it-is-from-an-unidentified-developer./)

发现Terminal里还是不是识别cmake指令,修改路径并export path 也不行(http://blog.csdn.net/ikscher/article/details/8348925),

就装了brew(http://stackoverflow.com/questions/20381128/how-to-install-homebrew-on-mac-osx):

Terminal:ruby-e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后用brew安装了CMake(https://github.com/travis-ci/travis-ci/issues/2175)

Terminal:

brew update

brew install cmake

4.安装OpenCV(http://opencv.org/downloads.html)

注意下版本,解压。

Terminal:

sudo port uninstall opencvcd opencv的目录mkdir buildcd buildcmake -G "Unix Makefiles" ..make -j8sudo make install

编译静态库(http://blogs.wcode.org/2014/10/howto-install-build-and-use-opencv-macosx-10-10/)1)打开CMake,选好opencv源码路径和静态库存放路径2)点击进行配置,去掉BUILD_SHARED_LIBS、BUILD_TESTS、WITH_1394、WITH_FFMPEG,添加x86_64到CMAKE_OSX_ARCHITECTURES,添加sdk到    CMAKE_OSX_SYSROOT,“/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk”3)重新配置并生成4)Terminal:cd 静态库目录make (This will take awhile)sudo make install

5.设置开发者活动目录

Teriminal:sudo /usr/bin/xcode-select –switch /Applications/Xcode.app/Contents/Developer

6.在Qt中使用

安装好Qt在Qt Creator中根据需要添加库,即可INCLUDEPATH += /usr/local/includeDEPENDPATH += /usr/local/includemacx: PRE_TARGETDEPS += /usr/local/lib/libopencv*.amacx: LIBS += -L /usr/local/lib/libopencv*开一个控制台测试程序测试之,必要时记得加

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 到pro里
或者


http://stackoverflow.com/questions/14940126/opencv-2-4-3-cant-find-imread-and-surffeaturedetectordetect



原文参考:http://drthitirat.wordpress.com/2014/09/21/install-opencv-2-4-9-and-qt-5-3-2-on-mac-osx-10-9-5-and-xcode-6-0-1/

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:在Mac上配置OpenCV+QT-创新互联
网页URL:http://cdxtjz.cn/article/hohij.html

其他资讯