Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Red eye reduction algorithm

I need to implement red eye reduction for an application I am working on.

Googling mostly provides links to commercial end-user products.

Do you know a good red eye reduction algorithm, which could be used in a GPL application?

like image 227
Aurélien Gâteau Avatar asked Sep 25 '08 14:09

Aurélien Gâteau


1 Answers

I'm way late to the party here, but for future searchers I've used the following algorithm for a personal app I wrote.

First of all, the region to reduce is selected by the user and passed to the red eye reducing method as a center Point and radius. The method loops through each pixel within the radius and does the following calculation:

//Value of red divided by average of blue and green: Pixel pixel = image.getPixel(x,y); float redIntensity = ((float)pixel.R / ((pixel.G + pixel.B) / 2)); if (redIntensity > 1.5f)  // 1.5 because it gives the best results {     // reduce red to the average of blue and green     bm.SetPixel(i, j, Color.FromArgb((pixel.G + pixel.B) / 2, pixel.G, pixel.B)); } 

I really like the results of this because they keep the color intensity, which means the light reflection of the eye is not reduced. (This means eyes keep their "alive" look.)

like image 86
Benry Avatar answered Sep 20 '22 09:09

Benry