Matting
The photo is the projection of real 3D world on film. A photo with foreground subjects can be treated as a composed image. Select out and separate the subject from its background is the inverse processing of composition/projection. Here matting means a computer implemented method to extract a selected subject from its background, by removing the background, and generating a matte signal containing a record of background levels outside of and within semitransparent subject areas.
There are 3 steps:
- Find the edge of the subject.
- Determine its opacity( transparent, semitransparent or opaque) for each pixel.
- For semitransparent pixels, inverse calculate its original color.
The 3rd step maybe the hardest step for understanding. Why we need a inverse calculation? See following sampleļ¼

The pixels in semitransparent area should be white in its original. But since it's semitransparent, the final color is blended with green(background). If we output it without a inverse calculation, and compose it into any other background except green, you will see the unreal green pixels.A reverse calculation will based on its opacity and current background color to output the real foreground color,which is white:

|