getting started with OpenCV in Python

I had a hard time training tesseract 3.02.02 for the mtrrdr OCR project so I've decided to try some options with OpenCV and SciPy. I was interested in testing the ideas posted here and here so I wanted to install OpenCV, NumPy, SciPy and matplotlib. I'm running Ubuntu 12.10, Python 2.7 and here's how I got setup:

For OpenCV, this SO post was very informative. I first downloaded OpenCV 2.4.4 from Sourceforge. I added some needed libraries, and then I followed the build instructions here.

$ sudo apt-get install cmake libgtk2.0-dev
$ mkdir opencv_binary_dir
$ cd opencv_binary_dir
$ cmake ../opencv-2.4.4
$ make
$ sudo make install

For SciPy I needed a few extra libraries, then I could install from pip:

$ sudo apt-get install liblapack-dev libatlas-dev python-dev gfortran
$ pip install scipy

NumPy is mercifully simple:

$ pip install numpy

And matplotlib:

$ sudo apt-get install libfreetype6-dev
$ pip install matplotlib

These all took a while to compile.. At the end you should be able to do this with no complaints:

$ python
>>> import cv2, numpy, scipy, matplotlib

..Unless you put SciPy, NumPy and matplotlib in their own virtualenv like I did. OpenCV is installed system-wide and is not known to your little virtual world unless you set some flags during your build. This SO post suggested the solution:

$ virtualenv /conf/virtualenvs/opencv
$ cd /conf/virtualenvs/opencv/lib/python2.7/site-packages
$ ln -s /usr/local/lib/python2.7/dist-packages/cv.py .
$ ln -s /usr/local/lib/python2.7/dist-packages/cv2.so .

Then you can activate the virtualenv and import at will:

$ . /conf/virtualenvs/opencv
(opencv)$ python
>>> import cv2