Assignment 1
The individual color channels are separated. These can be reconstructed by using the following linear filters. Red/blue filter = 0.25 * [ 1, 2, 1; 2, 4, 2; 1, 2, 1;]; Green Filter= 0.25 * [ 0, 1, 0; 1, 4, 1; 0, 1, 0;]; These filters are convolved to get the reconstructed color channels. The filters can be constructed by merely observing the pattern of individual color channels. The method I followed was to find separate filters for 4-neighbors and 2-neighbors cases. After that, we can combine the filters by observing that these filters don't overlap.
We have used linear interpolation to approximate the missing values. This does not hold true across edges. Hence, we observe bad coloring primarily around strong edges.
Prokudin-Gorskii captured three photographs for R, G and B color channels by a set of three cameras displaced by some vertical offset. The aim of this assignment is to align these three image channels so that we get a good color image. The program has fields for directory path and image filename. The function which does the alignment is alignImages. alignImages uses canny edge detection for finding edge-maps, normxcorr2 for finding the correlation and a window of [ -maxlag, +maxLag] in both X & Y directions to find the correct shifts. Function shiftImages shifts the channels using the above shifts. 1.2.2 Bonus: Algorithm acceleration
For this, I have implemented a function called multiScaleAlign which requires the pyramid height called scaleMax. I downsample by factor of 2scaleMax, find the shifts and go to the higher( image is bigger) level. For fast alignment at higher levels, I consider only a part of the image which is the center region when it is divided into 9 parts. The intuition behind this follows from the rule of thirds from photography. Matlab Filesa1_1.m a1_2.m alignImages function shiftImages function a1_bonus.m multiScaleAlign function Result ImagesHi-Res Result Images |