TP1

Colorizing the Image
Saeed Sojasi

Send Mail

GIF-4105/7105 Photographie Algorithmique by Professor Lalonde


Goal of Assignment

The goal of this assignment is to use image processing technique on glass images and automatically produce a color image by its three channels (RGB). For doing this assignment we should use alignment method with a simple X,Y translation. In this program we take a glass plate images as input and produce a single color image with as few visual artfacts as possible as output. First of all we divide the image into three equal parts and then we align the second and third parts to the first. We assume that each plate is in exactly 1/3 of the glass plat image. Also we print (x,y) displacement on top of each aligned images.

1. Single scale approach

To align R, G, B images the first important things is is to find different between channels. In this section for simplicity we use a small window of image for alignment. First of all we convert full image to double matrix then, we compute size for each channels. We divide full image to three equal part. By doing this we split full image to color channels (RGB). Now, we need to align these three channels and produce a color image. There are some useful functions for alignment such as: circshift,sum, and imresize (for the pyramid). We can use both Normalized Cross-Correlation (NCC) and Sum of Squared Differences (SSD). For displacement we use SSD. Finally, we use the cat function for concatenate three channels (RGB) and produce a color image.

1.1 Results

We can see the results of low resolution images by this method:

Small Images



Additional Small Images




2. Multiple scale approach

Both approaches, Single scale approach and Multiple scale approach, use same basic strategy with different performances. In this section, if we use displacement directly, it will take long time. Because, pixel displacement is too large. our images are large images then we need to use a faster search procedure such as an image pyramid. An image pyramid represents the image at multiple scale. For alignment large images we use pyramids. For this procedure we have imresize function. We take the original image and resized it by imresize function. After resized image we run SSD on the lowest resolution to get the displacement, and then translate that displacement to the next large resolution.

2.1 Results

We can see the results of high resolution images by this method:

Large Images



Additional Large Images




3. Become Prokudin-Gorskii!

In this section I took three pictures ,one after the another, from same scene and then I extracted the 'R' channel from the first, the 'G' channel from the second, and the 'B' channel from the third. I used cat function for vertical concatenate these three channels. Finally, I used the the single scale approach to produce a color image.

3.1 Results

Myself Images


4. Bells and Whistles

1. We alignment the image to enhance the contrast but this method is not work good for all images and those images have lots of textures in the edge.Therefore, we need a good method that it has optimization. For doing this we can use registration methods. Generally image registration divides into two groups. Rigid registration and non rigid registration. we use rigid registration when our images need translate and rotation. We use non rigid registration when our images have translate. For this assignment we have translate and a small rotating that effects of our hand shaking in the captured time. Therefore, we use rigid registration for this assignment and we use multi model methods because the intensity of of images are different.

2. For automatically cropping the border, we design a simple function to detect long edges removed them. We use a edge detector filter. There are some edge detector filters such as canny filter. This type of filter uses for image gradient and we convert output image to binary images. Therefore, output image is 1 or 0. Finally, we select raw and column in the border that have biggest value and crop these pixels.

3.If we do this program just for one image, we wont use this algorithm for other images. Certain adjustment for one image maybe has bad result for other images, then we used numerical values in program. Because we need a good program that it works on diffrent images with different values. In conclusion, as mention above we used a numerical values program.

4.1 Results

we can see the results of registered images and cropped images.

Registered and Cropped Images