We first try a combination of SelectRegion and InsideRangeFilter to create a mask of the red-eye regions. We append a GaussFilter to make the transition between detected red-eye iris and surroundings smoother. Note that a simple color-based approach is not enough for most images, because bright red colors will appear on several regions across the image.
We then proceed to synthesize a brown iris and an almost black pupil as a replacement for the red iris. This is done with a RandomFilter set to the corresponding eye color (here, brown), and another GaussFilter in combination with another InsideRegionFilter to create the smaller pupils region.
The original image minus the selected eyes regions is then merged with the synthesized eyes regions to give the output image.
While the resulting output image is already much better than the original red-eye input image, current computer-graphics algorithms used to synthesize eyes are much more complex (employing up to 40 or 50 layers of semi-transparent objects in order to match a 'real' eye).
Run the applet | Run the editor (via Webstart)