Ask Your Question
1

cvReleaseImage throws exception

asked May 31 '13

Marian gravatar image

I created an image by capturing camera simple:

IplImage *img;
CvCapture *capture = cvCreateCameraCapture(0);
CvSize size = cvSize(1920, 1080);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH , size.width);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT , size.height);
img = cvQueryFrame(capture);
cvNamedWindow("VideoTest", CV_WINDOW_AUTOSIZE);
cvShowImage("VideoTest", img);
cvReleaseImage(&img);

The problem is cvReleaseImage throws a memory exception. It cannot deallocate memory for image. How can I fix it?

Preview: (hide)

2 answers

Sort by » oldest newest most voted
1

answered May 31 '13

berak gravatar image

updated May 31 '13

yes, you should cvReleaseImage() all images you create,

but the image you get from the videocapture is the one exception to that rule. ( it hasn't got own memory, but uses mem inside the driver ) so don't release that!

Preview: (hide)

Comments

1

Or just switch to the C++ openCV2.0 API and stop worrying about allocating and releasing memory yourself :)

StevenPuttemans gravatar imageStevenPuttemans (May 31 '13)edit
0

answered May 31 '13

Prasanna gravatar image

Hey there Marian,

I am not able to reproduce your error on my computer. Can you please post your error details? It would be helpful to debug.

Regards, Prasanna S

Preview: (hide)

Question Tools

Stats

Asked: May 31 '13

Seen: 1,479 times

Last updated: May 31 '13