Ask Your Question

bts-007's profile - activity

2013-07-06 06:00:17 -0600 asked a question how to release camera when application is running

I thought when i==20 it will release the camera but the process is still holding the camera. How can I release it. I am sure cvQueryFrame is playing some role for not releasing the camera.

main( int argc, char* argv[] ) {
    int i=1;
    CvCapture* capture = NULL;
    capture = cvCreateCameraCapture( 0 );

    IplImage *frames = cvQueryFrame(capture);

    while(1) {      
        if (i==20)
            cvReleaseCapture ( &capture );

        char c = cvWaitKey(33);
        if( c == 27 ) break;
        i++;
    }
    return 0;

}