TP1:Colouring the Russian empire

By Cedric Tremblay

Project Goal

The core objective of this project was to create an algorithm that could produce a coloured RGB image when provided with a set of three similar grey pictures, each representing one of the colour channel. To test this algorithm, a few series of pictures taken from the Prokudin-Gorskii glass plate collection were used. These plates already containing the three colour channel stacked one on top of the other are divided into three separate images, which are then aligned relative to each other and finally combined to form the resulting colour image.

The Approach

First of all, the Prokudin-Gorskii pictures contain useless borders around the images. One is white, the other is black. In order to improve the final result the borders are trimmed as much as possible before anything else.

No_borders
Result with border trim
With_orders
Result without border trim

The main image is then separated in three, one for each of the colour channels. At this point, the channels need to be aligned in order to produce the corresponding RGB image. To obtain the displacement vector used to shift the second and third channel relative to the first, they are compared using the normalized cross-correlation method. The highest value returned by this algorithm indicates the position at which the two images best overlap. It is then only a matter of subtracting the new position to the original in order to find the displacement vector. Another method called the sum of squared differences could also have been used in order to compare the channels, however since the three channels do not have the same intensity (they represent different colours after all) the results that this method yield can be less than satisfactory. A sobel filter is also applied to each channel in order to get better results.

SSD
Result with sum of squared difference
NCC
Result with normalized cross-correlation

This method works well for small images (resolution wise), however for big pictures the comparison process can be timely. So in order to remedy to this problem, the image is recursively resized by half (from 100% to 50% to 25%, etc.) to an acceptable size and then the NCC is applied. On each call back, the displacement vector is multiplied by by the resize factor (e.g v[]*2 from 50% resolution back to 100%) and the SSD is computed on a very small window of pixels in order to try to reposition the vector.

Results

Resize
green offset: x=13 y=-72
red offset: x=31 y=-136
Resize
green offset: x=40 y=-42
red offset: x=56 y=-72
Smaller
green offset: x=1 y=-11
red offset: x=-1 y=-21
Smaller
green offset: x=25 y=-36
red offset: x=38 y=-89
Smaller
green offset: x=8 y=-52
red offset: x=33 y=-104
Smaller
green offset: x=5 y=-36
red offset: x=13 y=-51
Smaller
green offset: x=3 y=-12
red offset: x=5 y=-23
Smaller
green offset: x=25 y=-63
red offset: x=33 y=-114
Smaller
green offset: x=1 y=-11
red offset: x=1 y=-22
Smaller
green offset: x=2 y=-11
red offset: x=3 y=-22
Smaller
green offset: x=6 y=-42
red offset: x=5 y=-74
Smaller
green offset: x=0 y=-11
red offset: x=0 y=-20
Smaller
green offset: x=-1 y=-14
red offset: x=-1 y=-17
Smaller
green offset: x=1 y=-12
red offset: x=2 y=-22
Smaller
green offset: x=12 y=-79
red offset: x=20 y=-119
Smaller
green offset: x=18 y=-68
red offset: x=33 y=-113
Smaller
green offset: x=1 y=-12
red offset: x=1 y=-22
Smaller
green offset: x=2 y=-17
red offset: x=4 y=-32

Additional Images

Resize
green offset: x=0 y=-15
red offset: x=-1 y=-28
Resize
green offset: x=3 y=-12
red offset: x=2 y=-22
Resize
green offset: x=1 y=-12
red offset: x=4 y=-23
Resize
green offset: x=1 y=-5
red offset: x=4 y=-8
Resize
green offset: x=2 y=3
red offset: x=-3 y=-6
Resize
green offset: x=27 y=-70
red offset: x=61 y=-136
Resize
green offset: x=7 y=-60
red offset: x=9 y=-124
Resize
green offset: x=-11 y=-75
red offset: x=4 y=-108
Resize
green offset: x=-6 y=-67
red offset: x=-11 y=-130
Resize
green offset: x=23 y=-25
red offset: x=28 y=-34