Any chance that cvQueryFrame() returns an image that you should not
free?? When you do twice:

img = cam.queryFrame()
img = cam.queryFrame()

the first img is likely garbage-collected. Perhaps your
Image.__dealloc__ is not doing the right thing in this case?

Could you try to do:

cam = cvCreateCameraCapture(0)
img1 = cam.queryFrame()
img1.show()
img2 = cam.queryFrame()

and tell me if this also fails?




On Tue, May 19, 2009 at 9:57 PM, Chris Colbert <[email protected]> wrote:
> oops, sorry, I wrote the wrong things (it's getting late : )
>
> i'm actually erring on this
>
> ######### typdef ############
>
> cdef class CvCapture:
>
>     cdef c_highgui.CvCapture* thisptr
>
>     # convienience functions
>
>     def queryFrame(self):
>     # get and return an IplImage from from a capture source
>     # equivalent to img = cvQueryFrame(CvCapture* capture)
>     # make sure to set capture width and height before calling this
>         cdef c_cxcore.IplImage* img
>         cdef IplImage pyimg = IplImage()
>         img = c_highgui.cvQueryFrame(self.thisptr)
>         pyimg.thisptr = img
>         return pyimg
>
>     def __dealloc__(self):
>         c_highgui.cvReleaseCapture(&self.thisptr)
>
>
> def cvCreateCameraCapture(device):
>     cdef c_highgui.CvCapture* cap = c_highgui.cvCreateCameraCapture(device)
>     cdef CvCapture pycap = CvCapture()
>     pycap.thisptr = cap
>     return pycap
>
> ####################
>
> python code
>
> cam = cvCreateCameraCapture(0)
> img = cam.queryFrame()
> img.show()                                     <----- this works fine
> img = cam.queryFrame()                <---------- I crash here
>
>
> sorry for the confusion
>
>
> Chris
>
>
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to