Updated 1/17/10: The Portfile now includes a “+disable_openmp” variant. I encountered some OpenMP related segfaults in cvCalcOpticalFlowPyrLK which can be prevented with this variant.
In case you need OpenCV 2.0 on SnowLeopard in 64bit and can live without quicktime support (OpenCV 2.0 it has FFMPEG support so you should be OK in most cases) this tutorial is for you.
In case you want OpenCV 2.0 in 32 bit on 10.5 this probably works too, but I haven’t tested it. Just download the attached “Portfile” and follow the short steps underneath:
- Before starting execute
sudo port selfupdate
so that the most recent dependencies will be installed later on. Otherwise the build might fail.
- Make your own port directory somewhere, e.g.
- Let macports know about it by editing sources.conf, e.g.
> cd /opt/local/etc/macports
> sudo vim sources.conf
- Add the local port directory to the sources.conf before the rsync:// at the bottom of the file, e.g.
file:///Users/sam/ports # That is 3 slashes after file
- Create a graphics/OpenCV subfolder so that we have in our example
- Copy the downloaded Portfile into the above directory, make sure it is called Portfile not Portfile.txt
- Execute portindex in your local port directory, e.g.
> cd /Users/sam/ports
You should see a message telling you that the total number of parsed ports is 1
- Check if OpenCV 2.0 is found
> port search OpenCV
- Install OpenCV via
> sudo port install OpenCV
or on SnowLeopard in 64 bit but without quicktime support
> sudo port install OpenCV +sl_64bit
- Enjoy the time you have saved by not having to implement the algorithms in the new MachineLearning package all by yourself