Ask Your Question

shizzlej's profile - activity

2018-03-12 19:53:18 -0500 received badge  Notable Question (source)
2016-06-18 13:27:56 -0500 received badge  Popular Question (source)
2013-12-21 23:09:15 -0500 commented answer Camera is not getting release?

Thanks! That seemed to fixed it. Can you explain why it was so broken the way I was originally trying to do it with the pointer? (doing new then delete) I'm fairly new to C++. Don't have to but something I'd like to understand better if possible

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

Scratch that still the same thing happens. I forgot to reset the index used in videoStream(). Thanks for the input though!

2013-12-21 21:50:56 -0500 received badge  Editor (source)
2013-12-21 21:46:03 -0500 asked a question 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.