8

When I use fswebcam to capture a JPEG image from my webcam (an HP 2100) that is USB attached, it is always black?

  • Try the command fswebcam -d /dev/video0 -r 640x480 -v -S 10 --set brightness=100% test_image.jpg – Alaeddine Harizi Apr 10 at 13:37
16

When we use fswebcam to grab an image, it appears that the camera is initialized, grabs an image and then disconnected. Some webcams have function to automatically balance their brightness. For example, in a dark room they sense that the brightness needs increased while in a bright area, the brightness may need to be decreased. The camera does this by examining its own frames and analyzing them. When a grab of an image occurs immediately after the camera is initialized, it hasn't seen enough data to know how bright the environment is and it appears that it assumes that the environment is SUPER bright and turns down its exposure control to minimum (resulting in a black image). As more frames are examined, the camera quickly adjusts its exposure settings.

To use fswebcam, we can supply it the option of -S <num> which is the number of frames that the camera should "see" and "skip" before it captures the image you want. I find that if I supply a skip of 20 the camera has had enough frames to self adjust its exposure and since we are processing 30 frames a second, that is still less than a second delay for grabbing 1 frame. For video streaming, we shouldn't have the problem as the camera will be initialized and stay initialized.

  • Skip at least 20 frames. I didnt get any improvements when skipping just 5 :-) – Ayman Apr 1 '16 at 14:41
1

You need to skip first few frames before capturing image, for more info see the blog post here

  • 1
    Since external links can disappear, would you mind capturing the necessary details from that post into your answer? This would allow others to find the answer on this site without having to click through. Use the correct attribution if needed. – Phil B. Oct 3 '15 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.