This project fundamentally relied on making small adjustments to the color overlays in order to cleanly overlap 3 separate images as an RGB color spectrum. For smaller images we use exhaustive search over an interval defined by a range of -50 to 50 and for larger images we use pyramid search to try to determine the optimal interval using a scaling factor of 1/2 with each level of the pyramid search. Our loss function to evaluate the standard loss was simply SSD Loss given in vectorized form by
((img1 - img2) ** 2).sum()
Image Processing fundamentally relied on the following steps
Single Scale processing was completed by aligning the green color spectrum against the blue and then aligning the red against the blue. Here alignment means using a range of -50 to 50 pixels as well as
np.rollto compute possible shifts of the first spectrum. This shift was the compared with the second spectrum (e.g.
align(r, b)would shift r and compare against the blue color spectrum) using the loss function defined above. For single shift scaling we observed there was often substantial noise around the periphery of the images, thus we only aligned the center 1/2 of the image (1/4 of the pixels were not considered from each edge during alignment). Single shift finally outputs the optimal shift that would most closely align the center of the image with the center of the secondary color spectrum.
Multi-scale pyramid processing fundamentally relied on the same logic as single-scale processing with substantial optimizations necessary for large images. This algorithm is defined by the following steps:
1 / RESIZE_FACTOR ^ LEVELS
After the alignment of the images had completed we used
exp.rescale_intensityfrom skimage to rescale color intensities and then wrote to the outfile.
The following are the required python packages
numpy==1.15.1 opencv-python==3.4.2.17 scikit-image==0.14.0 scipy==1.1.0 stsci.image==2.3.0 stsci.tools==3.4.13To regenerate all the images simply run
python3 main.pyThis will take each image in photos and write an output to "out_path/"
This is the application of image cropping to remove white borders from an image