I would like to suggest that you try the following algorithm instead.
I have tried this algorithm on Photoshop, pixel by pixel using mental arithmetic and it seems to work quite well.
I downloaded the 0.2.0 source and compile that so I could try the algorithm here, but it seems I'm not up to that yet - configure has a dependency on mono.pc that I can't find.
Please could you have a look at this and see if you think it's any use. It works by clamping the green to no more than twice the blue level and then clamping the red to no more than twice the green level. You could possible make it little more strict by using 1.5* instead of 2*. You need to leave some leeway for pinkish shades though, for when people accidentally select flesh rouns the eyes, and for coloured reflections in the pupils.
void f_pixbuf_remove_redeye (GdkPixbuf *src)
{
int width = gdk_pixbuf_get_width (src);
int height = gdk_pixbuf_get_height (src);
int i, j;
int r, g, b;
int channels = gdk_pixbuf_get_n_channels (src);
guchar *row = gdk_pixbuf_get_pixels (src);
for (i = 0; i < height; i++) {
guchar *col = row;
for (j = 0; j < width; j++) {
r = *col;
g = *(col + 1);
b = *(col + 2);
if(g > r * 2) {
g = r * 2;
*(col + 1) = g;
}
if(r > g * 2) {
r = g * 2;
*(col) = r;
}
col += channels;
}
row += gdk_pixbuf_get_rowstride (src);
}
}
Regards,
Steve Horsley.
_______________________________________________ F-spot-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/f-spot-list
