I have a Logitech QuickCam Messenger Communicate webcam, and I want to use it outdoors at daylight. In the Linux kernel's driver there si no option like backlight. Then I decided I'll write a script for backlight compensation. Now, I crop the webcam's image into 16 or more squares. Then the script examines the color average of each squares and I decide if the part is too light or too dark or is ok. Then if I have more then 2 dark/light squares I set the image more darker/lighter... But this method is not enough for my problem.. So, I need some help for a nice backlight compensation algorithm. I need mainly algorithm description or some source code.