Main page # Project 2 ## Description The main goal of Part 1 of this project was to calculate partial derivatives Dx and Dy of the cameraman image. There were several goals in Part 2: - produce a set of "sharp" images (with strong high frequency features) - produce a set of hybrid images which appear as different images based on the viewing distance (using low and high frequency features) - produce a set of images created by blending two images together The project had two big challenges: - devising algorithm for blending images together - finding and adjusting pairs of images that would work well for creating hybrid images and merged images ## Part 1.1
D_x
D_y
Gradient
Gradient with threshold 75
## Part 1.2 In part 1.1 the edges detected by gradient are quite choppy. So in this part I apply a gaussian blur to the image to smooth out the edges. I used 5x5 gaussian blur kernel with sigma = 1.
Blurred with gaussian
D_x
D_y
Gradient with threshold 25
There's a clear difference between edges detected in original image and blurred image. Edges detected in blurred image are smoother and less choppy. They are also thicker, more clear and less noisy. To make operations for smooth edge detection simpler and more efficient, I derived filters that blur and detect edges in one convolution operation. Using these filters resulted in the same images as illustrated above.
Gaussian filter
Gaussian D_x filter
Gaussian D_y filter
Gaussian gradient filter
## Part 2.1 For low frequency subtraction I used 8x8 gaussian blur kernel with sigma = 1. To perform low frequency in one convolution operation, I used matrix which resulted from summing the following matrix: - 8x8 matrix with 1 + sharpen_coefficient in the center - 8x8 gaussian blur kernel with sigma = 1 multiplied by negative sharpen_coefficient This matrix combines operations of calculating the high frequencies of the image and adding it to the original image. So the resulting matrix we get = original_image + (original_image - low_frequency_image) * sharpen_coefficient. I used sharpen_coefficient = 5. Results of applying this operation are shown below.
Taj original
Taj sharp
Peter original
Peter sharp
Cat original
Cat sharp
Statue of Liberty original
Statue of Liberty sharp

Sharping blurred image:
Prostokvashino original
Prostokvashino blurred
Prostokvashino blurred and then sharp
The sharpened image appears even sharper than the original one. We can see that some small details in textures might be missed since sharp image has more thick edges. While in blurred image small details such as eyes are noisy and not very clear, sharp image makes them as clear as in the original image. ## Part 2.2 In this part I used 20x20 gaussian blur kernel with sigma = 6. I also used 0.6 as weight for low frequency image and 0.4 as weight for high frequency image. Cat and tiger attempt failed since images were very close in style and it was hard to distinguish between them from different distances. Grayscale results:
Man from far, cat from close
Happy from far, serious from close
Zhiguli from far, porshe from close
Happy from far, angry from close
FAILED attempt (cat and tiger)

COOKIE: Color results (from my tests keeping colors of both images worked the best):
Man from far, cat from close
Happy from far, serious from close
Zhiguli from far, porshe from close
Happy from far, angry from close
FAILED attempt (cat and tiger)
Fourier analysis of my favorite pair (zhiguli and porshe):
Zhiguli fourier
Zhiguli low frequencies fourier
Porshe fourier
Porshe high frequencies fourier
Final result fourier
## Part 2.3 and 2.4 For image blending I used 10x10 gaussian blur kernel with sigma = 3. To smoothly transition between images I calculated mask values for pixels within 1/16 of the image size from the split line using the following formula: - mask[i] = 1 - (i - (mid - block_size)) / (block_size * 2) - elements to one side of the split line are 1, to another side are 0 (depending on right or left image) I used 5 levels of gaussian blur to blend images together. All results are colored (COOKIE). Appange result:
Laplacian level 1
Laplacian level 2
Laplacian level 3
Laplacian level 4
Last Gaussian level
Final result

Triden result:
Laplacian level 1
Laplacian level 2
Laplacian level 3
Laplacian level 4
Last Gaussian level
Final result

Porshgli result (irregular mask):
Laplacian level 1
Laplacian level 2
Laplacian level 3
Laplacian level 4
Last Gaussian level
Final result