The Python Imaging Library has an ImageStat module that gives you, among other things, mean RGB intensity values. I just averag those to get a crude overall brightness number.
It seems to do well enough, but I think I'm going to have to add in some notion of time of day and sunrise/sunset calculations to sanity check things -- right now, it does fine when things get dark, but when the sun rises and it gets brighter throughout the day, it's not changing from the nighttime to daytime shutter setting properly. I think I need to tell it that, no matter how bright/dark the image is, the outdoor setting needs to be used during the day. Otherwise, it tries to dial down the brightness using the night-time shutter setting and the image is completely washed out, but the brightness level is within a normal range. The necessity to screw around with three separate settings to get a usable image out of it is rather disappointing.
You've never run into this?
Edited by tonyc (14/03/2011 17:51)