Generate a colorized photo based on three monochromatic photo taken roughly at the same position. The goal is to adjust the position of the photo to align them together. If perfectly aligned, they can be colored as red, blue, green and be stacked togethor to generate a colored photo.
NCC G[0,0] R[8, -1] | SSD G[-3,7] R[108, 17] | SSD G[112,-3] R[110, 3] |
SSD G[42,16] R[89, 22] | NCC G[69,-4] R[119, -16] | SSD G[82,4] R[177, 8] |
SSD G[52,22] R[107, 35] | SSD G[50,-2] R[133, -5] | SSD G[51,5] R[105, 7] |
SSD G[117,-7] R[107, 1] | NCC G[145,-7] R[119, -15] | SSD G[53,-5,5] R[67, -16] |
My algorithm did not align image the workshop very well. I think it might be because of the tone and color of the image is quite similar. I think I can improve by expanding the contrast of the pixels. Also, I would like to use edge detection to better align image with clear boundries.
I implemented the outcropping by looking for maximum color difference in a certain range on the top bottom and left right margin. I set the range from 1/20 onwards so that it can crop the discolored margin.
before | after |
Automatic white balancing by multiplying each pixel by 0.5/the average color of the image. To lighten the picture, one can set the value to 0.8.
before | after setting average to 0.5, a grey day scenario |