views:

48

answers:

1

Hello I have a problem when grouping the OpenCV's functions in functions of my own and getting segmentation fault.

Even with code as simple as this

def acquire_imagen():
  capture = cv.CaptureFromCAM( 0 )
  img = cv.QueryFrame( capture )
  return img
img = acquire_image()
print img[0,0]

If I call the same instructions outside the function everything is ok. I have an Idea of what may be happening but not enough knowledge about python to prevent it. I think the object is being freed by the GC.