Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Camera Not Being Released

Hi all I have

while (!janela->FINALIZADA ) {
camera >> frame;
  cv::imshow(janelasNome[0], frame);
 key = cv::waitKey(5) & 255;
            if (key == 99 || FIM) {
                 cv::destroyAllWindows();
                camera.release();
                break;
            }
}

but the camera is not being released. I tried to call camera.release() after the end of the while but the camera isn't being released either. I know that because it keeps with the lights on and when i try to open again the programs crashs and gives me

HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV VIDIOC_STREAMON: Bad file descriptor OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/schirrel/Github/opencv/opencv-2.4.10/modules/highgui/src/window.cpp, line 261 terminate called after throwing an instance of 'cv::Exception' what(): /home/schirrel/Github/opencv/opencv-2.4.10/modules/highgui/src/window.cpp:261: error: (-215) size.width>0 && size.height>0 in function imshow

how can i force the camera release?

btw i tried to put an amount of camera.release() one after another and nothing changes.