In this homework, we use image alignment algorithms to colorize the Prokudin-Gorskii Photo Collection!
We use raw pixel intensities as features for alignment. This can be implemented in two ways:
To optimise the algorithm for high-resolution images, we implement a multi-scale version. We compute optimal green and red shift with blue channel for alignment, further stack these images to get the color image.
Details:
SSD v/s NCC: We choose SSD over NCC as its fast to compute. Also, running some initial tests, both SSD and NCC gave exact same alignment offsets for both red and green channels.
Image Pyramid Hyper-parameters: I chose to use 5 image pyramids, scaling down with a factor of 2 at each levell. I choose row displacement range [-15, 15] and column displacement range [-15, 15]. Changing these parameters affects the inference time of the algorithm. I'll optimise these later for better results!
Note: we denote the alignment offsets for red and green channels below the image.
Cathedral
Color images looks decent but,
Idea is to use edge features for alignment while matching at each pyramid level. We use Sobel Filter for our experiments. Alignment is done when the edges maps instead of raw RGB channels. This makes alignment robust to varying pixel intensities across channel.
We notice black and white borders in the given images. Removing these enhances alignment and improves the overall aesthetic of the image. I hard-coded 10% to remove borders as i noticed this pattern in the dataset. But also can use more adaptive approach. Pixels with intensities above 250 were considered white, below 10 were black (scaled by 255 for float images). Rows or columns with a black/white ratio exceeding 70% were removed, aiming for greater robustness against border artifacts.
I use the following functions from PyTorch to update my implementation:
torch.mean
torch.norm
torch.nn.functional.interpolate
torch.roll
torch.tensor
Please find the complete implementation from the code uplaoded on gradescope!