2019-08-27 13:54:23 -0600 | received badge | ● Notable Question (source) |
2018-10-24 17:17:01 -0600 | received badge | ● Popular Question (source) |
2016-01-15 07:01:56 -0600 | commented question | videocapture.read() returning black frame if camera did not have time to initialize Thanks for comment, but this is more a workaround than a solution. Same thing as I did, by sleeping for a few until successful capture. |
2016-01-14 11:08:50 -0600 | asked a question | videocapture.read() returning black frame if camera did not have time to initialize Hi, I am currently working on a camera capture project. The problem is, even though camera gets opened correctly, sometimes the cap.read(frame) returns a black frame. After some tests, I noticed that putting a Sleep of 1-2 seconds after cap.open() solves the problem. Without sleep, seems like that cap.read() is performed before that the camera is actually ready for capture. But instead of failing and returning false, it just grabs a black frame. Also, checking for frame.empty() does not work, since frame is not empty, it is just all black. Any idea on how to solve this, of course without having to sleep for a while after camera open? |