GNOME Bugzilla – Bug 91795
Easy red eye removal tool
Last modified: 2006-04-24 10:04:48 UTC
Recently changing from JASC Paintshop Pro 7.04 in Windows, I miss the red-eye removal tool. Although know it is possible to do manually, but I have hundreds of photos and manually removing the red-eye on each one would take an age. The Paintshop Pro tool took seconds to use and has a more than adequate output for casual photographers. In case you are unfamiliar with the Painshop Pro tool I have described some of its main features below. It brought up a seperate window whhich allowed editing before changing the photo. It recognised the face area and zoomed into it automatically. You dragged a circular sleection over the red-eye area and it would recognise the rough shape of the eye and draw in over the red-eye. This could be adjusted by incresing the size of the selection and dragging the selection around. Different colours and shades of eye were possible as well as different iris sizes. Options for red-eye removal for animals (presumably looking for green rather than red,) and manual selection with a freehand tool were all possible. Other (lesser used,) options included, feather, blur, glint lightness, glint size, pupil brightness, centre glint and refine. Results were shown in a preview window before you accepted the changes. Perhaps this could be included as a plugin for the GIMP. I'm sure that it would win much more acceptance from ameteur photographers, especially with the recent popularity of digital photography.
A script was written to make this easier after the various long methods were described in an article in Linux Journal. I will try and find the script but a easy user friendly plugin with an interactive Dialog like Paint Shop Pro or other tools would definately be really useful. A screenshot of this feature might be helpful to a developer interested in adding this feature, if you could attach a screenshot to this bug report it would be helpful, if you cant I will try and do it myself at a later date.
Changes at the request of Dave Neary on the developer mailing list. I am changing many of the bugzilla reports that have not specified a target milestone to Future milestone. Hope that is acceptable.
This looks to me like a useful plug-in for future inclusion. Of course someone still have to write it :) In the meantime we could maybe distribute the script that was mentioned.
I don't have access to Paintshop right now. I'll be able to post screenshots after the 10th of August.
I have taken several screenshots of PaintShop Pro 8 but I am quite dissapointed by thier Red-eye 'removal' tool. I hope to provide a write-up soon. I'll post to the developer mailing list and here too if I remember. I hope to look at other Red-Eye tools. The most important thing we can do is to find and make sure we can get GPL/LGPL/or better rights to use the Script that was written and posted at LinuxJournal.com in response to a Linux Journal article several months ago.
http://linuxjournal.com/article.php?sid=6567 Script included in the article, I expect it can be improved and hopefully licensing can be sorted out quickly. I'll try and contact the author tomorrow.
Created attachment 19616 [details] Examples of tool applied to non-redeye areas for analysis
Created attachment 19617 [details] Example of adjustable selection tool and the result
I contacted Eric Jeschke author of the article instead of Martin Guldahl <mguldahl@xmission.com> who is author of the script. Will try again.
Attached are some screenshots from Paintshop Pro 7.04. The one with examples applied to non-redeye areas will hopfully give you a idea of what sort of algorythm is used. The right hand window is used to navigate around the larger picture with a drag tool. The left window is used for creating selections and showing previews of the final image before accepting changes.
I've been tinkering with that red-eye script. In the previous version, it registered two functions - one that removed red-eye using Desaturate, and one that removed red-eye using a plug-in I wrote: the <a href="http://registry.gimp.org/plugin?id=1918">Channel Mixer< /a>. In the latest version <a href="http://www.xmission.com/~mguldahl/projects.html/red-eye.scm">red-sys.scm</A>, I combined the two functions into one with a "Method" to select how one wants remove red-eye. Give it a try. I tested it in 1.2 and it works ok, but the Channel Mixer does not (yet) compile in 1.3.
There was interested to include the plug-in in GIMP proper. It shouldn't be hard to port a plug-in to the new API. Any particular problems you have that we could help you with?
Looks trivially portable to 1.3, but could stand some general code cleanup.
I just found an interesting article on automatic red eye removal: http://www.crl.hpl.hp.com/who/people/ulichney/bib/papers/2002-redeye%20-%20ICIP.pdf Basically they first use an algorithm from Viola and Jones (lots of info about that on the Internet) to recognize a face in a picture. Within the bounding box of that face they then look for redness and compensate for that. Real neat. Step 1 (looking for the face) is the hardest, but I think there's actually an Open Source project on sourceforge that has code for this. Will add link as soon as I've found it.
Project with code for recognizing faces in an image: http://sourceforge.net/projects/kolmogorov Code is in C++, but shouldn't be too difficult to translate to C. This would make a very nice graduate project. Hopefully I will have some time to experiment with this myself.
Lindows/Linspires lphoto has a red eye removal tool. It's written in python and the code is GPL. The Homepage: http://www.linspire.com/lphoto The Code: http://software.lindows.com/emptypool//lindowsos/pool/main/l/lphoto/lphoto_0.11-0.0.0.45.lindows0.1.tar.gz
I really would like to see this feature implemented. -Fenix*NBK* (fenix@theopencd.net)
The KDE photo editor digikam http://digikam.sourceforge.net/ (I'm using version 0.7) has red-eye reduction which works fairly well (open an image, select a region, then it's the menu item Fix->Red Eye Reduction). This is a GPL-ed program, so perhaps the algorithm that it employes can be a starting point for Gimp's red eye reduction feature. I think that Gimp will benefit big time from this functionality.
That functionality is available for GIMP for quite a while already. See for example http://gimpguru.org/download/red-eye.scm and http://fmg-www.cs.ucla.edu/geoff/digicam/redeye
I hope that we can use the new SIOX foreground extraction algorithm to implement a reasonable semi-automatic red-eye removal tool. But first, let's implement the SIOX tool, then look at red eyes again...
Here is an updated plug-in for red eye removal. It is based on the redeye plug-in by Robert Merkel, found at http://registry.gimp.org/plugin?id=4212 It is a patch against the current GIMP CVS, updated with documentation, i18n, preview etc. to be as usable as other GIMP plug-ins. The plug-in uses thresholding to detect red pixels, and removes the red color component. To use the plug-in, simply select a region surrounding the eyes, apply the filter and adjust the threshold until the red eyes are removed. I have tested it on a wide range of red colored eyes found though a google search, an example is attached. The results will be better if you make a selection around the eyes, to prevents other red regions in the image to be detected. I believe that automatic removal of red eyes is impossible. This plug-in doesn't use the SIOX tool to automatically detect the red eyes. I have experimented with detecting the red component using the SIOX tool manually, and so far the tool has not been able to accurately segment out the red regions only, usually there are red pixels in the border of the selection-result from the SIOX tool.
Created attachment 64136 [details] [review] Patch for red eye removal against current GIMP CVS
Created attachment 64137 [details] Demonstration of using the red eye removal plug-in
Thanks a lot for your work. I will look at the attached code as soon as possible and add it to the CVS tree if I find it to be suitable. Setting milestone to 2.4.
Added to CVS after some minor changes: 2006-04-23 Sven Neumann <sven@gimp.org> * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/common/redeye.c: added Redeye Removal plug-in, written by Robert Merkel and Andreas Røsdal. Fixes bug #91795. Closing as FIXED. But someone should look at making the plug-in use the new GimpZoomPreview widget.
2006-04-24 DindinX <dindinx@gimp.org> * plug-ins/common/redeye.c: use a zoom preview instead of a drawable one.