Tutorial:  Image Composition using Photoshop


Basic Concept

By image composition we usually mean extract one or more objects in different images and put them together to synthesis a new image. In the Intelligent Scissor project, you create a useful tool that allows a user to cut an object out of one image and paste it into another. For example, we can replace Prof. Hertzmann's face on the left image with Prof Curless' face in the middle and the composite image is on the right. 

Prof Hertzmann in Japan Prof Curless in Sieg Prof Curless in Japan

Description

The techniques behind the composition is very simple. There basis steps involved are: image segmentation, shape transformation, color adjustment. 

Image Segmentation

Image segmentation can be achieved by using your Intelligent Scissor tool. After you finish a closed contour in the scissor tool and choose "save mask" menu item, you will get a binary mask image, in which the segmented objects in the contour (including the contour) is white and other regions are black. Taking an example of Curless' case, the contour and mask are show below: 

When you composite this image to a background image, the white mask pixels indicate which pixel should be drawn over the background and black ones indicate not. The same principle applies to composite more than two images, where multiple images (each one has a mask) are drawn onto a background in a predefined order and each mask decide which part of the image should be drawn over the background and images drawn previously.

You can do this mask based operation in Photoshop easily, where each image may consist of several layers. 

  1. You can open a background image and a foreground image and a foreground mask image in Photoshop. 
  2. Create a new layer, layer 1, for your background image, copy the foreground image to layer 1 of the background image. To create a new layer, choose layer-->new-->layer menu item.
  3. Create a layer mask for the layer 1 of the back ground image, copy the foreground mask image to the layer mask. To create a mask, click the New Layer Mask button (leftmost button) at the bottom of the Layers palette.

Then you should be able to see the following picture. The problem is the original face size does not match the one in the background and they are not aligned either. We need to do some shape transformation.

Shape Transformation

The goal is to rotate and scale the foreground image so that Curless' face match Hertzmann's face. This is easy to do in Photoshop. You can select the layer 1 (by ctrl+A) and rotate and scale it (by first selecting edit-->transform-->rotate/scale and interacting with the mouse) till Curless' face is aligned with well with Hertzmann's face. During the rotating and scaling, you may find some mask pixels along the outside boundary of the mask images become while. You can fill them black by a right click and choosing fill menu item. After the transformation, you should see an image below:

Color Adjustment

After the shape transformation, the result is much better. However, the face is still sticking out of the background. One reason is the color of Curless' face is different Hertzmann's neck. One way to improve is change the color balance of the layer 1. You can achieve this by choosing "image-->adjust-->color balance" menu and change the R, G, B balance for Curless' face. Then you will see a better result shown bellow. 

When carry out any of the operation, please make sure that you are working on the proper layer. You can choose which layer to work with by selecting appropriate items in the Layers palette.

Others

Those are just basic steps to do image composition in Photoshop. Photoshop is a powerful tool and have many features. You can refer its help menu for more information and ask us. 


  • Last modified on January 23, 2002