Page 1 of 1
change the color of tshirt
Posted: 2010-12-21T08:53:44-07:00
by ratneshsoni
i send u link in which there is example of changing the color of t-shirt.While changing the color of t-shirt it not remove the wrinkles from t-shirt.
http://www.screencast.com/users/Ratnesh ... 74d16dcd81
it is possible in image magick like that. If not than how it could be possible
Re: change the color of tshirt
Posted: 2010-12-21T09:55:15-07:00
by fmw42
see the answers posted at
viewtopic.php?f=2&t=17672&p=66829&hilit ... ors#p66829
You will need to trace a mask of the tshirt and then process the whole picture with the following command. Then use the mask to select the background from the original and the colored shirt from the processed image. I have made a quick and dirty mask only. Follow Anthony's suggestions below about anti-aliasing if that is important.
origin
crude mask:
convert shirt.jpg -fuzz 17% -fill none +opaque white shirt_mask17.png
Processing:
convert shirt.jpg \( -clone 0 +level-colors black,lightblue \) shirt_mask17.png \
-compose multiply -composite shirt_lightblue.png
Re: change the color of tshirt
Posted: 2010-12-21T16:52:58-07:00
by anthony
It may be better if the mask have anti-aliased edges to 'feather' the edges a little.
If the original photo was on a darker background the mask may be easier to generate.
However the background of the image is more consistent with its coloring, so it may be posible to generate the T-shirt mask by subtracting the masks for the different parts of the background and skin colors. The edge however may need anti-aliasing.
Basically It would be better to generate the mask ONCE using a interactive image editor such a gimp, or photoshop. Once you have the mask however, automatic color adjustments is easy.
Multiply is one way of coloring is one way of adjusting the color, but may not work well along edges. A semi-transparent shading overlay, with a 'shirt shaped' transparent hole (with anti-aliases skin colored edges where appropriate) may work better.
The next step would be a distortion map to distort patterns and images so as to follow the 3-D curve and bumps of the shirt. such a map can be difficult to make, but is only needed to be created once, just like the mask or the suggested shaped and shaded hole overlay.