by Johnny_Bit » March 7th, 2007, 6:57 pm
Divide and conquer using scan lines. Simply: divide pic to about 16 regions, count average lightness of every area. Then count which area has biggest lightness picks and that area is sure to have at least one light. After locating regions with lights create one big region containing found lights. Divide that region again to 16 smaller regions and repeat the procedure, then you'll have small region that has most probably every light in it. locating exactly where is the light: find highest peaks and there you have your light.
For this one you'll need HLS coulor palette instead of typical RGB. conversion is fairly simple and I can give you routines for that.