Ask Your Question

socapex's profile - activity

2016-05-26 11:45:02 -0600 received badge  Scholar (source)
2016-05-26 11:44:59 -0600 commented answer VideoCapture::read frame drops with dark pixels.

Well auto gain/ auto contrast is desired for my use case (QR Code scanner). Running at 10fps is ok for that too. If I need more, I will just read on another thread. Also, I cannot choose the webcam ;)

Thx for the help though!

2016-05-25 18:08:09 -0600 received badge  Supporter (source)
2016-05-25 18:02:23 -0600 commented answer VideoCapture::read frame drops with dark pixels.

I think you didn't see my other comment due to moderation time. But yes, I tried both and it didn't work. The webcam seems to be adjusting its' behavior at a lower level than that. I also popped-open the settings panel (can't remember the constant though), and nothing was ticked "auto".

Anyways, a callback is what we need, but not what we deserve? lol

2016-05-24 22:19:36 -0600 answered a question VideoCapture::read frame drops with dark pixels.

Ok, so LBerger gave me a great lead when pointing out time exposure is at a low framerate. It seems the camera is simply lowering its' fps when exposure (gain?) is high. There doesn't seem to be a way to get the actual framerate of the cam (CV_CAP_PROP_FPS only returns the user set fps).

A hack is to lower the cam processing to 10fps instead of thirty. So when the webcam lowers its fps, you aren't stuck waiting for videocapture::read. A real solution would be a callback hookup into videocapture called when data is ready (like pretty much every audio API out there).

Since openCV doesn't seem to have that, another solution is to run the capture on a low priority thread, that can stall at read without affecting the rest of the app.

Hope this helps someone.

2016-05-24 22:19:35 -0600 commented answer VideoCapture::read frame drops with dark pixels.

Hi, thank you so much for answering. Unfortunately that didn't work :( But auto-exposure/gain is definitely on. I've been following the lead you gave me, but so far no way to turn it off. If you have any other ideas, I'd love to hear them! :)

2016-05-22 02:35:31 -0600 asked a question VideoCapture::read frame drops with dark pixels.

Hello, I have a strange performance problem with a standard and very simple webcam capture prototype. I am using openCV inside Unreal engine (if that changes anything). I read() a frame from my webcam every .033s (30fps capped) at 640x480. The CPU is not a problem :)

If my webcam is pointed at light colors, mainly a white frame, the fps is at 120 (the whole app is capped at 120). But whenever I move the webcam, to record things with darker colors, the fps drops to 8 frame per second!

I've been profiling a lot, and all my cycles are coming from 1 line: cap.read(f). This is extremely strange to me, and I am going to guess maybe openCV has defaults that do image processing? Anyone has experienced this before? Should the read method be deterministic?

Thank you for any help, I am just starting out with openCV, so it could be something really simple :)

P.S. Using windows build (x64) v3.1.0. These are unmodified from the download.