Sergey Chikuyonok did a great Job when adapting the cool Ambilight feature, well-known from some Philipps TV-Sets, to the HTML 5 <video> tag. Ambient Lighting Technology basically is a LED lighting system, generating lighting effects around the TV that correspond to the video content by adjusting the brightness and color based upon the picture content.
Click on the image below to watch the effect. You will need a browser that supports the <video> tag: Firefox 3.5, Google Chrome 4, Safari 4, Opera 10.5.
The basic algorithm assumes 5 LEDs on the left and the right side of the virtual TV-Set, takes the relevant part of the picture’s frame, divides it into 5 regions and calculates each part’s average color. To get enough light intensity, brightness and saturation of these colors must be boosted. To get a realistic lighting effect Sergey uses a linear gradient and a special mask overlay.