webcam-capture
webcam-capture copied to clipboard
Question: Get webcam timeout information, detect if no frames outputted
Hi developers,
In my app, I am interested in testing whether my webcam has an image available. It seems that when this is not the case, the logger reports a Timeout, then I get a black image. The webcam reports a 0 fps framerate. How can I check for this condition without trying to grab an image and waiting for the timeout?
Sample output: Code is not too special: I am grabbing a few images in a loop to try and detect the framerate, and I loop on the BufferedImage pixels to check that it is black, with all default parameters.
Sample output:
[main] INFO com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used
Detected Webcam: MYWEBCAM,0
[atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamOpenTask - Opening webcam MYWEBCAM,0
[atomic-processor-1] WARN com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice - Different size obtained vs requested - [176x144] vs [1920x1080]. Setting correct one. New size is [1920x1080]
[frames-refresher-[0]] ERROR com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice - Timeout when requesting image!
[frames-refresher-[0]] ERROR com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice - Timeout when requesting image!
Detected FPS: 0.0
Output image is uniformly black (0x000000)
[frames-refresher-[0]] ERROR com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice - Timeout when requesting image!
[atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamCloseTask - Closing MYWEBCAM,0
Related, I think: Issue 523 https://github.com/sarxos/webcam-capture/issues/523
Were you able to solve this issue? I am interested in the same thing