I’m trying to use OpenCV with Python and converting some C++ code. Anyway, if I do:
import cv
img = cv.LoadImage('image.jpg')
It’s ok. Or:
import opencv.cv as opcv
size = opcv.cvSize(40, 50)
But anyway, the cv module doesn’t have the cvSize data structure and the opencv.cv doesn’t have the LoadImage. So, what exactly does each module have? I tried looking in the documentation but couldn’t find it. Am I supposed to use it like this or is my setup misconfigured?
The real answer is 🙂 that both “import opencv.cv” or “from opencv import cv” are the old-style wrapping imports.
Since OpenCV 2.0, the new-style Python wrapping is used, and the style you should use looks like this:
The old-style wrappings made use of SWIG, the new-style wrappings, judging by the opencv 2.2 source code, seem to be self-made.