Sergei Mikhailovich Prokudin-Gorskii (1863-1944) was a man well ahead of his time. Convinced, as early as 1907, that color photography was the wave of the future, he won Tzar's special permission to travel across the vast Russian Empire and take color photographs of everything he saw including the only color portrait of Leo Tolstoy.
His idea was simple: record three exposures of every scene onto a glass plate using a red, a green, and a blue filter. The LoC has recently digitized the negatives and made them available on-line.
Since we want to align 3 color channels, with the idea of all color channel have similar brightness. So by comparing pixel brightness of 2 channels, use the Equation of Sum of Squared Differences (SSD) to represent alignment level. Find the lowest SSD to align 2 channels.
When processing big images (around 3000x3000 pixels), it is computationally expensive. We use pyramid method to deal with the problem. We resize the photo and aligning form small picture to big picture. As for a image sized around 400x400, the shift is less than 15. Based on this, we determined our pyramid aligning parameters and implementing our algorithm.
We calculate SSD for each columns and rows. As figure shown below, SSD on edge is usually much more bigger than SSD in the middle of the picture. So we can compare average SSD and edge SSD to detect the edge and then crop them.
row SSD compared to average SSD
after auto cropping | monastery.jpg |
after auto cropping | cathedral.jpg |