Saturday, September 3, 2011

OpenCV cvReleaseImage Crashing Problem

Random crashing can occur when you are using the cvQueryFrame function and the cvReleaseImage function together. With the below code implemented you can cause your program to sporadically crash.  The issue lies in releasing the frame.  The capture can be released safely.  Not sure why it does this but it does.

...
frame = cvQueryFrame(capture);
...
cvReleaseCapture&capture);
cvReleaseImage(&frame);
...