I need to get OpenCV working on my system for a couple of image processing tasks I have for work, and as with many complex software systems, it was somewhat difficult to get it working on my system, a macbook pro running Leopard (OS/X 10.5).
% mkdir build % cd build % cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PYTHON_SUPPORT=ON ../
- No swig on my system. The installation page lists it as an optional install, but it’s needed for python, and python is what I want (they say this, but I thought it would do something other than just ignore my desire for python). So install swig, and use the CMake GUI tool to make sure that your SWIG_DIR is set correctly.
- Couldn’t find my Python.h file. Since I had installed my python using darwinports, my Python.h isn’t really where it was looking. I fixed this by editing the CMakeCache.txt to change PYTHON_INCLUDE_PATH:PATH=/sw/include/python2.5. If your swig stuff is complaining about no Python.h (but you have one), find your Python.h and change this line in CMakeCache.txt. There’s probably a more elegant solution, but this worked.
- For some reason CMake was pointing to the wrong SDK on my system (. It wanted to use the 1.4u version, but I’ve got 1.5, so I changed /Developer/SDKs/MacOSX10.4u.sdk to /Developer/SDKs/MacOSX10.5.sdk using the CMake GUI.
- Couldn’t find my resulting opencv library. I copied it to the /Library/Python path.
- I wanted to make sure it installed all of the examples, so I selected them using hte CMake GUI utility.
Note that I did try the darwinports version, and lost a couple of hours trying to figure out how to get the python piece of that to work on my system. I don’t suggest that path.