ok I have this code
IplImage *frame;
CvCapture *capture = cvCaptureFromCAM(0);
frame = cvQueryFrame(capture);
cvSaveImage("sample.jpg",frame);
cvReleaseImage(&frame);
which saves an image, but after saving that image, I want to release that camera so that it closes. Now the camera stays on until the program stops, I want to relase and close the camera exactly after cvReleaseImage(&frame);
I tried
cvReleaseCapture(&capture)
but it gives me a runtime error: the application has requested the Runtime to terminate in an unusual way and this error
OpenCV Error: Bad argument (unrecognized or unsupported array type)
in unknown function, file ……\modules\core\src\array.cpp, line
996
I am not completely sure. But try removing the cvReleaseImage call.
I remember that the image-pointer retrieved by the cvQueryImage method points allways at the same adress. so my guess is that this image-data is managed by the capture. so releasing it is done when you release the capture.
EDIT:
found here:
http://opencv.jp/opencv-1.0.0_org/docs/ref/opencvref_highgui.htm