Tuesday, March 08, 2011

[Py] Use ``import cv'' in Ubuntu

At the beginning of my OpenCV learning with Python, I noticed one thing which confused me but I didn't give it further attentions. Some examples import the OpenCV modules by using ``import cv'' and some use ``import opencv.'' The first one has never worked to me, so I've adopted ``import opencv'' until today.

The problems were not only about the import approach. Although I found I can import opencv.cv module, which looked similar to the so-called cv module, there had been other problems about the function names. I noticed that many functions given by the opencv.cv module have the ``cv'' prefix, while the same functions given directly by the cv module don't. For example, opencv.cv offers open.cv.cvSomeFunction() while in cv it is cv.SomeFunction(). Based on the observation, I suspected that my installation of OpenCV an/or Python bindings are not totally right.

Thursday, March 03, 2011

Trials of pycam example code (2)

I've downloaded pycam and tested some of the sample codes. There were some errors when I tried to run the examples, such as DrawAHat.py and eyeLocator.py [1]. The error messages were as follows.