What is Image Re-composition?
'Image re-composition' consists of two steps: separating objects from their original photo (Matting) and placing them into others (composition). The generalized 'Image Processing' includes two aspects: 'Image Enhancement/Adjustment' and 'Image re-composition'. The former changes the representation of an image while the latter changes the contents.
There are two basic, but significant, concepts you need to know about image re-composition: background and foreground (the object). In most cases, the background is a regular rectangle image, while the foreground has no regular shape and which, when separated from its original image, is called the matting result.
The foreground object can be hard to understand by a beginner, as it introduces a new concept: the mask. The mask is a channel (usually it’s called the alpha channel) with same width and height of foreground image, and defines where the foreground pixels should be transparent and where they should be opaque, or between the two (semi-transparent). With transparent pixels, the user will see the background color, while with opaque pixels they will see the foreground object’s color. With semi-transparent pixels, a blend of both foreground color and background color will show.
In image re-composition software, the foreground object and its mask are contained in a structure called the ‘Layer’. The background is a special layer with no mask, called the 'Base Layer'. The foreground objects, as sometimes there are several objects, exist in different layers over the base layer. Using this program, the user can manipulate all the layers separately. The current layer in use is always called the 'Current Layer'. After the editing work is done, a merge operation will flatten all the layers into one image.
The following figure shows the relationship between layers in 3D space and how these layers will appear in the user interface.
What is Matting?
The photograph is the projection of the real 3D world on film. A photo with foreground subjects can be treated as a composed image. Selecting and separating the subject(s) from the background is the inverse processing of composition/projection. Here, matting means a computer implemented method of extracting a chosen subject from its background, by removing the background, and generating a matt signal containing a record of the background levels both outside of, and within, semi-transparent subject areas.
There are 3 steps:
- Find the edge of the subject.
- Determine its opacity (transparent, semi-transparent or opaque) for each pixel.
- For semi-transparent pixels, inverse-calculate its original color.
The third step may be the hardest step to understand. Why do we need an inverse calculation? See the following example:
The pixels in the semi-transparent area should be white, as in their original color. But since it's semi-transparent, the final color is blended with green (the background color). If we generate this without an inverse calculation, and then place it into any other background color except green, you will see the unreal green pixels. A reverse calculation will be based on the opacity and current background color (the area where you are placing it) to generate the real foreground color, which is white: