I have a basic question in regards to cvQueryFrame() in OpenCV.
I have the following code:
IplImage *frame1,*frame2;
frame1 = cvQueryFrame(capture
Ok !
You have to make a copy of your frame. frame1 = cvQueryFrame(capture); is a pointer as you said.
The code i found is :
IplImage* img1(null), img2(null);
CvCapture* cap = cvCaptureFromAVI("mavideo.avi");
img2 = cvQueryFrame( cap );
img1 = cvCloneImage( img2 ); // on alloue une nouvelle image
while( cvGrabFrame( cap ) )
{
cvCopy( img2, img1 ); // copie de l'image, pas du pointeur
img2 = cvRetrieveFrame( cap );
}
cvReleaseCapture( &cap );
cvReleaseImage( &img1 );
You can replace the while by a waitkey or anything but if you do that use
img2 = cvQueryFrame( cap );
instead of
img2 = cvRetrieveFrame( cap );
cause you'll not have the
cvGrabFrame( cap )
anymore
I don't know if i'm clear so... i stay here ^^
Enjoy ;)
Laurent