I'm interested in using it on to recognize buildings in satellite/aerial photographs - I'll explain more if I get the idea to work.
The first step is to get OpenCV up and running on my Mac (OS X Lion 10.7.4). The library has a lot of dependencies that need to be installed but thankfully there is a Homebrew recipe for doing all of the heavy lifting... almost... I ran into a few problems but here is what I needed to do.
In principle all you need is:
$ brew update $ brew install opencvBut I got two errors:
1: brew wanted me to update my version of Xcode from 4.2 to 4.3
On Lion you update Xcode via the App store and it turns out that 4.4 is available. So I installed that and reran 'brew install opencv'
2: brew then complained that the Python package 'numby' (Numerical Python) was not installed. Brew does not install Python dependencies but suggested that I do this with:
$ easy_install numbyI did that but I still got the error.
I've got two versions of python installed (via homebrew)
$ python --version Python 2.7.3 $ python3 --version Python 3.2.3For our purposes you only want to deal with Python 2 - version 3 should work but the homebrew package seems to want version 2
Given the problem with easy_install, I went with a manual installation
1: Download the tar file for the latest stable version of numby
http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/
2: Unpack the file into a temporary directory and cd into it
3: Run the python setup script
$ python setup.py installSit back and relax as this takes a while. Everything went smoothly for me and hopefully for you too.
All being well you can now run
$ brew install opencvAgain this takes a while - about 9 minutes on my box. You will get a message at the end of the output telling you to add the following to your .bash_profile
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"OpenCV has an excellent interface to Python, but I work primarily in Ruby so the next step for me is to get an OpenCV ruby gem set up and start to do some image processing. The next post on this blog will cover that.
No comments:
Post a Comment