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

3 Answers
3

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.

The function cvQueryFrame grabs a frame from camera or video file,
decompresses and returns it. This function is just a combination of
cvGrabFrame and cvRetrieveFrame in one call. The returned image should
not be released or modified by user.

ok, what would come between brackets cause cvReleaseCapture(&capture) gives me a runtime error: the application has requested the Runtime to terminate in an unusual way
–
TasostheGreatAug 16 '11 at 10:49

ok, what would come between brackets cause cvReleaseCapture(&capture) gives me a runtime error: the application has requested the Runtime to terminate in an unusual way
–
TasostheGreatAug 16 '11 at 10:48

Are you sure it crashes just after cvReleaseCapture(&capture) ? It works fine for me.
–
GenísAug 16 '11 at 13:51

yes just after cvReleaseCapture do you run the latest release of opencv? Do you do something with capture, do you set it to zero or sanything else? The code I posted doesn't work for me
–
TasostheGreatAug 16 '11 at 13:56

could you maybe post the code that worked for you?
–
TasostheGreatAug 16 '11 at 13:58

Not the latest: I'm using Opencv 2.2. And I don't do anything with the capture
–
GenísAug 16 '11 at 14:04