Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Camera is not getting release?

Hi support,

I can't seem to find the answer for this one. Someone had asked it before but he wasn't given a solution and I'm not sure if one was found (this was a year ago or so from the date of it). Here's a snippet of the code I'm running and the only part of it I'm concerned with:

videoStream = new cv::VideoCapture(2);

if ( !videoStream->isOpened() )
{
    addDebug("Capture failed!");
    delete videoStream;
    return;
}

*videoStream >> incFrame;

if ( !incFrame.empty() )
{
    incFrame.release();
}

videoStream->release();
delete videoStream;

The problem is that this code will work the first time but never again during the lifetime of my program. If I close it and open the software again it works fine. I notice that after the camera is supposed to be released, it still looks like it is in use from looking at its LED. Is there something else I'm missing in regards to releasing the camera? I'm on OpenCV 2.4.5. I'm compiling on Ubuntu 12.04.

click to hide/show revision 2
Added error messages

Camera is not getting release?

Hi support,

I can't seem to find the answer for this one. Someone had asked it before but he wasn't given a solution and I'm not sure if one was found (this was a year ago or so from the date of it). Here's a snippet of the code I'm running and the only part of it I'm concerned with:

videoStream = new cv::VideoCapture(2);

if ( !videoStream->isOpened() )
{
    addDebug("Capture failed!");
    delete videoStream;
    return;
}

*videoStream >> incFrame;

if ( !incFrame.empty() )
{
    incFrame.release();
}

videoStream->release();
delete videoStream;

The problem is that this code will work the first time but never again during the lifetime of my program. If I close it and open the software again it works fine. I notice that after the camera is supposed to be released, it still looks like it is in use from looking at its LED. Is there something else I'm missing in regards to releasing the camera? I'm on OpenCV 2.4.5. I'm compiling on Ubuntu 12.04.

------------------ EDIT --------------------

Here are the messages I get everytime I try to execute the code when the software is in this state:

HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

VIDIOC_STREAMON: Bad file descriptor

Unable to stop the stream.: Bad file descriptor

Camera is not getting release?

Hi support,

I can't seem to find the answer for this one. Someone had asked it before but he wasn't given a solution and I'm not sure if one was found (this was a year ago or so from the date of it). Here's a snippet of the code I'm running and the only part of it I'm concerned with:

videoStream = new cv::VideoCapture(2);

if ( !videoStream->isOpened() )
{
    addDebug("Capture failed!");
    delete videoStream;
    return;
}

*videoStream >> incFrame;

if ( !incFrame.empty() )
{
    incFrame.release();
}

videoStream->release();
delete videoStream;

The problem is that this code will work the first time but never again during the lifetime of my program. If I close it and open the software again it works fine. I notice that after the camera is supposed to be released, it still looks like it is in use from looking at its LED. Is there something else I'm missing in regards to releasing the camera? I'm on OpenCV 2.4.5. I'm compiling on Ubuntu 12.04.

------------------ EDIT --------------------

Here are the messages I get everytime I try to execute the code when the software is in this state:

HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

VIDIOC_STREAMON: Bad file descriptor

Unable to stop the stream.: Bad file descriptor

------------------ EDIT 2 ------------------

Okay I ran this same code on a laptop with a built-in webcam and it worked fine. The camera would turn off as I would expect. I guess it's just something either with the PC I was using or the camera I was using.