tags:

views:

237

answers:

2

Hi- I'm using Python 2.6 against OpenCV 2.0. I've started a file capture and pulled frames. I've displayed the image to make sure it's valid. When I call this routine, python crashes:

def SmoothImage(self,SmoothingMaskSize=3):
    temp=cv.CreateImage(cv.GetSize(self._lpImage),self._lpImage.depth,self._lpImage.nChannels)
    cv.Smooth(self._lpImage,temp)
    self._lpImage=temp

I've also tried smoothing it in-place, using cv.Smooth(self._lpImage, self._lpImage)

I'm new to Python- am I missing something obvious?

Thanks!

A: 

The bindings that come with the OpenCV 2.0 installer are buggy; I had similar problem where some very simple operations triggered crashes. Compiling from the source should fix it.

Johannes Sasongko
Thanks Johannes! I pulled the source from SVN and re-compiled. Despite checking it in CMake, the python support was not compiled, but once I did that manually, everything was good to go.
Mike O'Malley
A: 

If you don't need access to the object-oriented parts of OpenCV, you should take a look at ctypes-opencv, which is a better set of python bindings. It is lovingly hand-crafted, in contrast to the SWIG-generated bindings that come with OpenCV, and I have never found any bugs in it.

http://code.google.com/p/ctypes-opencv/

forefinger