Page 1 of 1

exclude flesh tones from color transformation?

Posted: 2007-12-07T22:02:44-07:00
by a new world
I want to be able to crank up the saturation and contrast of an image but minimize the effect on flesh tones (if any) in the image. Needless to say, it doesn't have to get it right 100% of the time, just as long as it gets it more or less right most of the time.

How can I accomplish this?

Re: exclude flesh tones from color transformation?

Posted: 2007-12-11T18:00:08-07:00
by anthony
Oh that should be reasonably simple..

Create a mask of the image defining the 'flesh tones'.

One simpe way would be to make any 'flesh color' transparent for example...

Code: Select all

   convert image.jpg -matte -fuzz 40% -transparent '#DF9E25'  non-flesh.png
Note that the Fuzz Factor is a 3 dimensional sphere in the RGB colorspace (or whatever colorspace the image is in). A different color space or smaller 'spheres' with a number of different color centers, may work better to define what you mean by 'flesh-tone'

It may also vary by the lighting and the 'race' of the person in the image, as well as just how big a difference there is between 'flesh' and 'background'.

Can you please post your 'flesh-tone' color definition when you have worked it out. It would be a useful thing to have, especially for programs that classify images.

Once you have the above the way you want it, do your saturation changes, and just overlay back over your original image. The 'flashy' parts will appear unchanged though the 'holes' you made in the image.

NOTE the use of PNG in the above. Do not use JPG as 1/ it is lossy and losses quality from read/save cycle, and 2/ it does not understand transparency.

Re: exclude flesh tones from color transformation?

Posted: 2007-12-11T22:54:32-07:00
by a new world
Skin tone examples here:

http://www.idigitalemotion.com/tutorial ... ntone.html

http://www.polykarbon.com/tutorials/skintones/tone1.htm

This is going to be used for thumbnailing basically so ultimate quality loss isn't that big of a concern.

Re: exclude flesh tones from color transformation?

Posted: 2007-12-11T23:05:23-07:00
by anthony
Thanks.

Okay that gives you a three point gradient though RGB (or whatever) colorspace.

From that you will expand the number of colors to 5 or 9 points, and then adjust the fuzz or thickness of the line to match all the flesh colors of that type.

Keep us informed of your progress in matching skin tones, even roughly.
For example will you have some automatic way of figuring out what skin tone gradient is needed for some particular image. and what sort of fuzz factor you use.

PS: I am quite certain that a different color space will probably match better than RGB which is probably about the worst colorspace for real-life images. Its designed for computer monitors, not humans, just as CYMK was designed for printers.