When I use fswebcam to capture a JPEG image from my webcam (an HP 2100) that is USB attached, it is always black?
2 Answers
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.
- 1,794
- 2
- 16
- 28
You need to skip first few frames before capturing image, for more info see the blog post here
- 121
- 1