Dynamic webcam control (update)

Several weeks of testing revealed that my Python script for time-dependent webcam control works quite reliable. However, there were a few over-/or underexposed images close to sunset or sunrise. Turning off auto-exposure during daytime helped to prevent overexposed pictures, especially on bright and sunny days.

These fixed exposure settings resulted in too dark images on rainy and cloudy days. Since most webcams are optimized for indoor use, it is safe to use auto-exposure settings under these weather conditions. But how to let a script decide about that? For this purpose, I adopted the ImageStat function of the Python Imageprocessing Library (PIL), which allows to calculate an average arbitrary value for brightness. If it drops below a certain threshold level, auto-exposure settings are activated. Before calculation of brightness, the image is converted to gray-scale. The whole operation is done in memory, without the need to save a temporary file to disk.

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments