I am trying to use OpenCV 2.0 in python on a Mac. I need to be able to convert between the OpenCV IPL format and the PIL Python Imaging Library format.
The top answer on this question How do I create an OpenCV image from a PIL image? suggests using a module called “opencv.adaptors” to do the conversion, but since I am using OpenCV 2.0, I do not have a module called “opencv” (I have “cv” instead), and there does not appear to exist any “cv.adaptors”.
The answer you have linked is quite outdated. The reason adaptors is gone now is because it is no longer needed. Python bindings for OpenCV images now support the array interface (
__array_struct__and__array_interface__), so you should be able to just useImage.fromarraymethod from PIL to go one way, andcv.fromarrayorcv.SetDatato go the other way.