Computational Photography and Capture, Spring 2010

Labs

Home | Syllabus | Course Work | Assessment | Labs

Labs5: Colour Transfer

Here is a description of colour grading/colour transfer from François Pitié (taken from this page):

Original

Target Palette

Results











A major problem in the post production industry is matching the colour between different shots possibly taken at different times in the day. This process is part of the large activity of film grading in which the film material is digitally manipulated to have consistent grain and colour. The term colour grading is used here specifically to refer to the matching of colour. Colour grading is important because shots taken at different times under natural light can have a substantially different feel due to even slight changes in lighting.

Currently in the industry, colour balancing (as it is called) is achieved by experienced artists who use edit hardware and software to manually match the colour between frames by tuning parameters. For instance, in an effort to balance the red colour, the digital samples in the red channel in one frame may be multiplied by some factor and the output image viewed and compared to the colour of some other (a target) frame. The factor is then adjusted if the match in colour is not quite right. The amount of adjustment and whether it is an increase or decrease depends crucially on the experience of the artist. This is because it is a delicate task since the change in lighting conditions induces a very complex change of illumination. It would be beneficial to automate this task in some way.

The technique proposed here is an example-based re-colouring method which can be illustrated by the picture above. The original picture is required to be transformed so that its colours match the palette of the image in the middle, regardless of the content of the pictures.

The goal of today's labs is to use the implementation of Francois Pitié to create a photomontage with matching colors. The technique used is Probability Density Function Transfer and you can read the paper here.

The idea behind the paper is that we want to match the 3D (rgb) histogram of the source image with the 3D (rgb) histogram of the target image. To do so, we project the histograms on 1D axis and do a 1D matching, which is easy. Every time we project the histogram on some 1D axis and do the matching, we get a little closer to the 3D solution. By projecting the 3D histogram onto many different 1D axis, we roughly capture all its features, and that is done by using a lot of 3D rotations matrices (they represent 3 orthonormal axis). The algorithm is described in the section 3.

The code to do the pdf transfer is available here. As you will see, it needs a cell array filled with 3D rotations. Your first task is to create that cell array, and fill it with random 3D rotation matrices.

The second task is to make a script that let you create a photomontage. First pick 2 photos with different looks. When you run the script, it should display the first image and let you select a region of interest, that you want to paste in the second photo. After that you should be able to choose the position in the second photo where you want to paste it. Then, run the pdf transfer code to give the area you want to paste the look of the target photo. Finally, find a way to paste this area in a smooth way in the target image. Because of the color transfer method, the photomontage will look more uniform since everything will share the same color palette.