CS 280A Project 2 : Fun with Filters and Frequencies! by Phudish Prateepamornkul

Part 1: Fun with Filters

Part 1.1 : Finite Difference Operator

We applied the partial derivative in x and y direction where D_x = [1, -1] and D_y = [[1], [-1]]. Then we compute the gradient magnitude image by computing the sqrt((df/dx)^2 + (df/dy)^2) and then I binarize my image using the threshold to be 0.25 all the image will show below

Cameraman with partial derivative in x
Cameraman with partial derivative in x
Cameraman with partial derivative in y
Cameraman with partial derivative in y
Cameraman with gradient magnitude
Cameraman with gradient magnitude
Cameraman with binarize the gradient magnitude
Cameraman with binarize the gradient magnitude

Part 1.2 : Derivative of Gaussian (DoG) Filter

We applied the gaussian filter with kernel size 12 and the sigma to be 2 and then we applied the same partial derivative in x and y direction where D_x = [1, -1] and D_y = [[1], [-1]]. Then we compute the gradient magnitude image by computing the sqrt((df/dx)^2 + (df/dy)^2) and then I binarize my image using the threshold to be 0.05 all the image will show below. The difference from the first part is that the images are smoother and the gradient magnitude is more clear.

Cameraman with Gaussian Filter
Cameraman with Gaussian Filter
Cameraman with Gaussain Filter and convolve with partial derivative in x
Cameraman with Gaussain Filter and convolve with partial derivative in x
Cameraman with Gaussain Filter and convolve with partial derivative in y
Cameraman with Gaussain Filter and convolve with partial derivative in y
Cameraman with Gaussian Filter and applied gradient magnitude
Cameraman with Gaussian Filter and applied gradient magnitude
Cameraman with Gaussian Filter and applied binarize gradient magnitude
Cameraman with Gaussian Filter and applied binarize gradient magnitude

We can also get the same result by creating a derivative of the gaussian filter and then convolve the image. The result show below which we can see that the result is the same as above.

Image of the Gaussian two dimension
Image of the Gaussian two dimension
Image of the Gaussian convolve with partial derivative in x
Image of the Gaussian convolve with partial derivative in x
Image of the Gaussian convolve with partial derivative in y
Image of the Gaussian convolve with partial derivative in y
Image of the convolved Cameraman Gaussian convolve with partial derivative in x
Image of the convolved Cameraman Gaussian convolve with partial derivative in x
Image of the convolved Cameraman Gaussian convolve with partial derivative in y
Image of the convolved Cameraman Gaussian convolve with partial derivative in y
Image of the convolved Cameraman Gaussian with gradient magnitude
Image of the convolved Cameraman Gaussian with gradient magnitude
Image of the convolved Cameraman Gaussian with binarize gradient magnitude
Image of the convolved Cameraman Gaussian with binarize gradient magnitude

Part 2: Fun with Frequencies!

Part 2.1 : Image "Sharpening"

We applied the low pass filter then we subtract the low pass filter with kernel size 12 and sigma to be 2 from the original image to get the high pass filter. Then we add the high pass filter to the original image to get the sharpened image. We picked the alpha value to be 2.

Low Frequency of Taj Mahal
Low Frequency of Taj Mahal
High Frequency of Taj Mahal
High Frequency of Taj Mahal
Sharpened Image of Taj Mahal
Sharpened Image of Taj Mahal

Then we applied this technique to the the new image and then applied the same technique to the image where we use kernel size to be 12 and sigma is 2. Then we applied various alpha value to the image to see the different result.

Original Image of Moo Deng
Original Image of Moo Deng
Low Frequency of Moo Deng
Low Frequency of Moo Deng
High Frequency of Moo Deng
High Frequency of Moo Deng
Sharpened Image of Moo Deng with alpha is 0
Sharpened Image of Moo Deng with alpha is 0
Sharpened Image of Moo Deng with alpha is 1
Sharpened Image of Moo Deng with alpha is 1
Sharpened Image of Moo Deng with alpha is 2
Sharpened Image of Moo Deng with alpha is 2
Sharpened Image of Moo Deng with alpha is 3
Sharpened Image of Moo Deng with alpha is 3
Sharpened Image of Moo Deng with alpha is 4
Sharpened Image of Moo Deng with alpha is 4
Sharpened Image of Moo Deng with alpha is 5
Sharpened Image of Moo Deng with alpha is 5
Sharpened Image of Moo Deng with alpha is 6
Sharpened Image of Moo Deng with alpha is 6
Sharpened Image of Moo Deng with alpha is 7
Sharpened Image of Moo Deng with alpha is 7
Sharpened Image of Moo Deng with alpha is 8
Sharpened Image of Moo Deng with alpha is 8
Sharpened Image of Moo Deng with alpha is 9
Sharpened Image of Moo Deng with alpha is 9

Part 2.2 : Hybrid Images

We applied the low pass filter to derek image where we applied kernel size of 54 and sigma to be 9 and high pass filter we applied kernel size to be 36 and sigma to be 6 to the cat image. Then we add the two image together to get the hybrid image.

Image of Derek Aligned
Image of Derek Aligned
Image of Nut Meg Aligned
Image of Nut Meg Aligned
Low Frequency of Derek
Image of Derek with Low Frequency
High Frequency of Nut Meg
Image of Nut Meg with High Frequency
Hybrid Image of Derek and Nut Meg
Hybrid Image of Derek and Nut Meg

We then applied this technique to a few more pictures and we will use that in some case the hybrid image works but in some case it does not work where the last case is failed case.

Image of Tom Holland Aligned
Image of Tom Holland Aligned
Image of Robert Downey Jr Aligned
Image of Robert Downey Jr Aligned
Low Frequency of Tom Holland
Image of Tom Holland with Low Frequency
High Frequency of Robert Downey Jr
Image of Robert Downey Jr with High Frequency
Hybrid Image of Tom Holland and Robert Downey Jr
Hybrid Image of Tom Holland and Robert Downey Jr
Image of Elderly Aligned
Image of Elderly Aligned
Image of Young Aligned
Image of Young
Low Frequency of Elderly
Image of Elderly with Low Frequency
High Frequency of Young
Image of Young with High Frequency
Hybrid Image of Elderly and Young
Hybrid Image of Elderly and Young
Image of Tam Aligned
Image of Tam Aligned
Image of Moo Deng Aligned
Image of Moo Deng Aligned
Low Frequency of Tam
Image of Tam with Low Frequency (Failed Case)
High Frequency of Moo Deng
Image of Moo Deng with High Frequency (Failed Case)
Hybrid Image of Tam and Moo Deng
Hybrid Image of Tam and Moo Deng (Failed Case)

Then we show the log magnitude of the Fourier Transform of the two input images, the filter images and the hybrid image.

Fourier Transform of Elderly
Image of Fourier Transform of Elderly Aligned
Fourier Transform of Young
Image of Fourier Transform of Young Aligned
Fourier Transform of Low Frequency Elderly
Image of Fourier Transform of Low Frequency Elderly
Fourier Transform of High Frequency Young
Image of Fourier Transform of High Frequency Young
Fourier Transform of Hybrid Image of Elderly and Young
Image of Fourier Transform of Hybrid Image of Elderly and Young

Part 2.3 : Gaussian and Laplacian Stacks

We implement a Gaussian and Laplacian stack and we apply it to the apple and orange image where we use kernel size to be 18 and sigma to be 3 for both of the images. We also apply the gaussian stack to the mask as well to get the blened image.

Image of Apple Gaussain Stack 0
Image of Apple gaussian stack 0
Image of Apple Gaussian Stack 1
Image of Apple Gaussian Stack 1
Image of Apple Gaussian Stack 2
Image of Apple Gaussian Stack 2
Image of Apple Gaussian Stack 3
Image of Apple Gaussian Stack 3
Image of Apple Gaussian Stack 4
Image of Apple Gaussian Stack 4
Image of Orange Gaussain Stack 0
Image of Orange gaussian stack 0
Image of Orange Gaussian Stack 1
Image of Orange Gaussian Stack 1
Image of Orange Gaussian Stack 2
Image of Orange Gaussian Stack 2
Image of Orange Gaussian Stack 3
Image of Orange Gaussian Stack 3
Image of Orange Gaussian Stack 4
Image of Orange Gaussian Stack 4
Image of Apple Laplacian Stack 0
Image of Apple Laplacian stack 0
Image of Apple Laplacian Stack 1
Image of Apple Laplacian Stack 1
Image of Apple Laplacian Stack 2
Image of Apple Laplacian Stack 2
Image of Apple Laplacian Stack 3
Image of Apple Laplacian Stack 3
Image of Apple Laplacian Stack 4
Image of Apple Laplacian Stack 4
Image of Orange Laplacian Stack 0
Image of Orange Laplacian stack 0
Image of Orange Laplacian Stack 1
Image of Orange Laplacian Stack 1
Image of Orange Laplacian Stack 2
Image of Orange Laplacian Stack 2
Image of Orange Laplacian Stack 3
Image of Orange Laplacian Stack 3
Image of Orange Laplacian Stack 4
Image of Orange Laplacian Stack 4
Image of Mask Gaussain Stack 0
Image of Mask Gaussain Stack 0
Image of Mask Gaussain Stack 1
Image of Mask Gaussain Stack 1
Image of Mask Gaussain Stack 2
Image of Mask Gaussain Stack 2
Image of Mask Gaussain Stack 3
Image of Mask Gaussain Stack 3
Image of Mask Gaussain Stack 4
Image of Mask Gaussain Stack 4
Image of Blendding level 0
Image of Blendding level 0
Image of Blendding level 1
Image of Blendding level 1
Image of Blendding level 2
Image of Blendding level 2
Image of Blendding level 3
Image of Blendding level 3
Image of Blendding level 4
Image of Blendding level 4
Image of Blended
Image of Blended

Part 2.4: Multiresolution Blending

We applied the previous technique to two more images and we use kernel size of 18 and sigma to be 3 for both images.

Image of Beach Gaussain Stack 0
Image of Beach Gaussain Stack 0 or Original Image
Image of Beach Gaussain Stack 1
Image of Beach Gaussain Stack 1
Image of Beach Gaussain Stack 2
Image of Beach Gaussain Stack 2
Image of Beach Gaussain Stack 3
Image of Beach Gaussain Stack 3
Image of Beach Gaussain Stack 4
Image of Beach Gaussain Stack 4
Image of Desert Gaussain Stack 0
Image of Desert Stack 0 or Original Image
Image of Desert Gaussain Stack 1
Image of Desert Gaussain Stack 1
Image of Desert Gaussain Stack 2
Image of Desert Gaussain Stack 2
Image of Desert Gaussain Stack 3
Image of Desert Gaussain Stack 3
Image of Desert Gaussain Stack 4
Image of Desert Gaussain Stack 4
Image of Beach Laplacian Stack 0
Image of Beach Laplacian Stack 0
Image of Beach Laplacian Stack 1
Image of Beach Laplacian Stack 1
Image of Beach Laplacian Stack 2
Image of Beach Laplacian Stack 2
Image of Beach Laplacian Stack 3
Image of Beach Laplacian Stack 3
Image of Beach Laplacian Stack 4
Image of Beach Laplacian Stack 4
Image of Desert Laplacian Stack 0
Image of Desert Laplacian Stack 0
Image of Desert Laplacian Stack 1
Image of Desert Laplacian Stack 1
Image of Desert Laplacian Stack 2
Image of Desert Laplacian Stack 2
Image of Desert Laplacian Stack 3
Image of Desert Laplacian Stack 3
Image of Desert Laplacian Stack 4
Image of Desert Laplacian Stack 4
Image of Mask Gaussian Stack level 0
Image of Mask Gaussian Stack level 0
Image of Mask Gaussian Stack level 1
Image of Mask Gaussian Stack level 1
Image of Mask Gaussian Stack level 2
Image of Mask Gaussian Stack level 2
Image of Mask Gaussian Stack level 3
Image of Mask Gaussian Stack level 3
Image of Mask Gaussian Stack level 4
Image of Mask Gaussian Stack level 4
Image of Blendding level 0
Image of Blendding level 0
Image of Blendding level 1
Image of Blendding level 1
Image of Blendding level 2
Image of Blendding level 2
Image of Blendding level 3
Image of Blendding level 3
Image of Blendding level 4
Image of Blendding level 4
Image of Blended
Image of Blended
Image of Soccer Gaussain Stack 0
Image of Soccer Gaussain Stack 0 or Original Image
Image of Soccer Gaussain Stack 1
Image of Soccer Gaussain Stack 1
Image of Soccer Gaussain Stack 2
Image of Soccer Gaussain Stack 2
Image of Soccer Gaussain Stack 3
Image of Soccer Gaussain Stack 3
Image of Soccer Gaussain Stack 4
Image of Soccer Gaussain Stack 4
Image of Dark Sky Gaussain Stack 0
Image of Dark Sky Stack 0 or Original Image
Image of Dark Sky Gaussain Stack 1
Image of Dark Sky Gaussain Stack 1
Image of Dark Sky Gaussain Stack 2
Image of Dark Sky Gaussain Stack 2
Image of Dark Sky Gaussain Stack 3
Image of Dark Sky Gaussain Stack 3
Image of Dark Sky Gaussain Stack 4
Image of Dark Sky Gaussain Stack 4
Image of Soccer Laplacian Stack 0
Image of Soccer Laplacian Stack 0
Image of Soccer Laplacian Stack 1
Image of Soccer Laplacian Stack 1
Image of Soccer Laplacian Stack 2
Image of Soccer Laplacian Stack 2
Image of Soccer Laplacian Stack 3
Image of Soccer Laplacian Stack 3
Image of Soccer Laplacian Stack 4
Image of Soccer Laplacian Stack 4
Image of Dark Sky Laplacian Stack 0
Image of Dark Sky Laplacian Stack 0
Image of Dark Sky Laplacian Stack 1
Image of Dark Sky Laplacian Stack 1
Image of Dark Sky Laplacian Stack 2
Image of Dark Sky Laplacian Stack 2
Image of Dark Sky Laplacian Stack 3
Image of Dark Sky Laplacian Stack 3
Image of Dark Sky Laplacian Stack 4
Image of Dark Sky Laplacian Stack 4
Image of Mask Gaussian Stack level 0
Image of Mask Gaussian Stack level 0
Image of Mask Gaussian Stack level 1
Image of Mask Gaussian Stack level 1
Image of Mask Gaussian Stack level 2
Image of Mask Gaussian Stack level 2
Image of Mask Gaussian Stack level 3
Image of Mask Gaussian Stack level 3
Image of Mask Gaussian Stack level 4
Image of Mask Gaussian Stack level 4
Image of Blendding level 0
Image of Blendding level 0
Image of Blendding level 1
Image of Blendding level 1
Image of Blendding level 2
Image of Blendding level 2
Image of Blendding level 3
Image of Blendding level 3
Image of Blendding level 4
Image of Blendding level 4
Image of Blended
Image of Blended