Installing openCV 2.4.2 on Mac OS X 10.9 (Mavericks)

前端 未结 7 538
暗喜
暗喜 2020-12-04 16:06

I\'m trying to install openCV 2.4.2 (not the newest version but stable version compatible with newer OS X according to several sources) on Mac OS X 10.9 (Mavericks). I have

相关标签:
7条回答
  • 2020-12-04 16:36

    This may be related to the current issues with Qt on Mavericks.

    See: https://github.com/mxcl/homebrew/pull/23793

    I'd try installing the current patched homebrew keg for qt, and then installing opencv:

    brew update
    brew uninstall opencv
    brew uninstall qt
    brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD
    brew install opencv
    

    Caution to the wind: the qt build took me about an hour to complete

    0 讨论(0)
  • 2020-12-04 16:40

    Run the following commands assuming you have brew installed.

    brew tap homebrew/science
    brew install opencv
    
    0 讨论(0)
  • 2020-12-04 16:41

    You could disable ts module in CMakeCache.txt file:

    //Include opencv_ts module into the OpenCV build
    BUILD_opencv_ts:BOOL=OFF
    

    I mean that there is no reason to modify existing code.

    0 讨论(0)
  • 2020-12-04 16:45

    I think you really need to do a configuration and that is it.

    I tried your problems and I think steps are as follow:

    1. open terminal in mac
    2. in the terminal, check you have cmake and ccmake. If not, please type "brew install cmake"
    3. go to your downloaded opencv folder, make a new folder by typing "mkdir build", then "cd build"
    4. in this build folder, check you have gcc and g++ installed.
    5. now, doing configuration by type "ccmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++", type "c" first for configuration then exit by "e" then "g" for generating!
    6. you should be in terminal again now! then please type "make"
    7. type "sudo make install", and now the opencv is installed, check it by type "brew list", and you should see the opencv there
    8. type "brew linkapps"
    9. do a test if you have python, by typing "import cv", and it should be working!
    0 讨论(0)
  • 2020-12-04 16:46

    You can try to install opencv from homebrew, I met the same problem with cmake in my 10.9 and finally I found the solution from Chris Muktar. Here are the steps:

    1. Make sure xcode-select --install Xcode command line tools 5.0.1 are installed.
    2. Install python using brew - brew install python.
    3. pip update
    4. pip install numpy
    5. brew linkapps
    6. Add export PYTHONPATH=/usr/local/Cellar/opencv/2.4.6.1/lib/python2.7/site-packages:$PYTHONPATH to .bash_profile in your home directory
    7. brew install opencv

    In the last step I came across the Error: No available formula for opencv. In this case, you should first run the command brew tap homebrew/science.

    Good Luck

    0 讨论(0)
  • 2020-12-04 16:48

    Use macports. Once you install macports, just run

    sudo port install opencv
    

    at the command prompt.

    This other stackoverflow question is mostly correct for how to start using the macports version of opencv in Xcode.

    Here are some more up-to-date instructions for using the macports version of OpenCV from Xcode 5:

    1. Create a new Xcode project as OS X Application -> Command Line Tool, etc.
    2. Click the target in the upper left
    3. Click the Build Settings tab
    4. Scroll down to (or search for) the Search Paths section
    5. Under User Header Search Paths add /opt/local/include
    6. Click the Build Phases tab
    7. Click Link Binary with Libraries
    8. Choose the required libraries from /opt/local/lib
      1. At least, add libopencv_core.dylib
    9. If you want pre-set command-line arguments, go to Product -> Scheme -> Edit Scheme (⌘<)
      1. Click the Run tab on the left
      2. Click the Arguments tab
      3. Enter arguments into Arguments Passed on Launch
    10. Done!
    0 讨论(0)
提交回复
热议问题