conversion from PIL image to OpenCV image fails

Bug #398925 reported by Zak Stone
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenCV
Unknown
Unknown
opencv (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python-opencv

The following method of setting the data of an OpenCV image fails with version 1.0.0-6.1ubuntu1 of libcv1 and python-opencv:

image = cv.cvCreateImage(size, cv.IPL_DEPTH_8U, 3)
image.imageData = data # set some data

In particular, this breaks the conversion from PIL images to OpenCV images in adaptors.py. I believe this issue has been corrected in more recent versions of OpenCV -- many helpful details about the problem are available here:

http://www.depthfirstsearch.net/blog/2008/09/22/opencv-and-python/

Thanks,
Zak

Revision history for this message
Oliver Gerlich (ogerlich) wrote :

The bug is known upstream (at http://sourceforge.net/support/tracker.php?aid=1618474) and is fixed in upstream CVS (at http://opencvlibrary.cvs.sourceforge.net/opencvlibrary/opencv/interfaces/swig/python/imagedata.i?r1=1.3&r2=1.4).

The patch from CVS is attached below. It applies without problems, but apparently the _cv.cpp file which is generated by Swig is not regenerated automatically. Adding --with-swig to the "configure" flags (for example in debian/rules, at the end of "confflags = " line) is a workaround for this.

Changed in opencv (Ubuntu):
status: New → Confirmed
Revision history for this message
Matthias Klose (doko) wrote :

fixed in 2.1 (natty)

Changed in opencv (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.