PDA

View Full Version : As3 upload image mask out hair and smooth skin steps???



kingsta
December 28th, 2009, 03:17 PM
hello I'm looking for the best steps in AS3 Flash CS4 to make a simple application for

1. My friends to upload a close up image of them self.

2.It masks out their hair and It automatically smooths their skin ( with a airbrushed smooth look) vector like.

3. They can change hairstyles and try on different things like glasses.

Questions 2 is the main question I need answered for now.

Please note that I am not advanced or an expert in AS3 but I did study allot and understand the main basics and allot of the beyond the basics tutorials online. Call me a Great Newbie that and put it together with proper steps to follow. Thx allot guys

creatify
December 28th, 2009, 07:25 PM
Automatically masking hair would be quite a challenge, an extreme challenge not knowing what background would be behind the head in the image. For example, there are "hair mask" plug-ins for photoshop and they use some fairly extreme algorithms to achieve that, but usually require some type of user input / definitions before the mask is made. If you want to provide a tool for the users to upload their photo, then use some tools to say "spray paint" and erase the background, that would be much easier. Or, if you want them to be able to isolate their face, you could build a paint type tool so they could highlight their face via painting in that area, then set up a loop to basically cut/copy that part of their image to another BitmapData instance.

Smoothing the skin would probably require some type of interpolation algorithm so that you run over your bitmap pixel-by-pixel and interpolate the average colors which then those averages would get drawing to the BitmapData instance via setPixel.

For finding average colors, this might steer you in the right direction - see here (http://blog.soulwire.co.uk/flash/actionscript-3/extract-average-colours-from-bitmapdata/).

If the hair mask doesn't have to be automatic, I'd look for some flash paint / draw tutorials, then also look for some tutorials on edge detection within flash if you want to try to automate this - I didn't closely review these, but they may also help:

not sure if all of these are AS3, but just google "flash edge detection" or "actionscript edge detection"
see here (http://www.kirupa.com/forum/showthread.php?t=273427)
see here (http://www.quasimondo.com/archives/000690.php)
see here (http://visualrinse.com/2008/05/09/progress-with-painting-we-have-edge-detection/)

Hope this helps.