[magick-users] Finging Face edges and remove backgrounds (correction)
Claus Cyrny
claus.cyrny at web.de
Wed Jan 21 01:33:11 PST 2009
Claus Cyrny wrote:
> Hi Chris,
>
> Chris Cinelli wrote:
>> Hi,
>>
>> I am trying to find an automated effective way to:
>>
>> 1) detect the face edges and minimize the details in the face (like nose
>> etc) in a portrait image. The images are taken on white background
>> but it may be a little gray and
>> have shadows. The ideal result would be an image that has in black thick
>> borders of the edges of the faces, the hair, eyebrows and a minimal
>> details
>> of nose and mouth. Everything on a white background. Anybody can help
>> with
>> that ?
>>
>> 2) remove the background and make that part of the image transparent.
>> Again
>> it is still a portrait with a white-ish background.
>
>
> regarding the background part, I tried this successfully myself,
> albeit with a strictly white background. In your case, I would
> copy the image and paint over the face in a bitmap editor like
> Gimp etc. in order to remove the face completely and have just
> the background on a separate image. You can then proceed as
> follows (this is a shell script for Linux, but you can modify
> this easily for any other OS):
>
> ----
> #!/bin/sh
>
> convert image_with_face.extension -fuzz 25% -background.extension \
> -compose change-mask -composite final_image.extension
>
> display final_image.extension
> ----
sorry, I found an error in the script. Actually, it should read:
#!/bin/sh
convert image_with_face.extension -fuzz 25% -transparent white
background.extension \
-compose change-mask -composite final_image.extension
display final_image.extension
Besides that, I realized that on a background with shades
of white this will probably not work. One quick solution
in order to get a white background would be, to select the
background (with the quickmask inside a bitmap editor)
and change the levels/curves, until the background is just
white.
Claus
>
> The last line is optional, of course. You may have
> to try out different valuers for '-fuzz'.
>
> Here's an example from my blog (the text is in
> German, but I guess the image speaks for itself):
>
> http://grafomatic01.twoday.net/stories/4839779/
>
> I found this to work really smoothly, and as you can
> see, the final image doesn't contain any color "spill"
> at the edges of the object.
>
> HTH,
>
> Claus
>
--
Claus Cyrny : Webdesign | Grafik | Fotografie
:: Web: http://home.arcor.de/ccyrny/ ::.
More information about the Magick-users
mailing list