Filters and Frequency

Mengyang Zhang

Finite Difference Operator

part 1.1

To calculate the partial derivatives of of D_x and D_y, I first turned these two vectors into a 2d matrix of [[1, -1]] for D_x and [[1],[-1]] for D_y. Then apply the scipy.signal.convolve2d with the original picture

To calculate the gradient, the magnitude of the gradient is (dx ** 2 + dy ** 2) ** 1/2

D_X
partial derivative in dx
D_y
partial derivative in dy
D_X
gradient magnitude
D_y
edge Images

part 1.2

Compared with the previous ones, the DoG filters gives us more smooth edges, since guassian itself is a low-pass filter and blur the images
It also shows less noise compared with the previous one, since guassian will blur the noises

D_X
partial derivative in dx
D_y
partial derivative in dy
Gradient
gradient magnitude

DoG filters ones

D_X
partial derivative in dx
D_y
partial derivative in dy
Gradient
gradient magnitude

part 2.1 Image Sharpening

The process is to blur the image with the gaussian first and get low frequecies
Then substract it from the original image to get higher frequecy part.
Add the higher frequecies part onto the original image to get the sharpening effect.

D_X
taj
D_y
sharpened taj
D_X
etch
D_y
sharpened taj
D_X
berkeley
D_y
sharpened berkeley

part 2.2 hybrid images

In order to hybrid two images:
Blur one images with the guassian filters
Subtract the blurred image2 from the original image2 to get the higher frequecy part
Combine the two modified images

D_X
Man
D_y
cat
D_y
cat-Man

FFT analysis for the previous 3 pictures

D_X
Man
D_y
cat
D_y
cat-Man
D_X
Me
D_y
Peng
D_y
lol
D_X
Peng again
D_y
Me again
D_y
lol lol

More examples here

Part 2.3 Guassian and Laplacian Stacks

Guassian Stack production process:
  • First layer is the original image.
  • Use guassian blur the previous layer repeatedly
  • Laplacian Stack production process:
  • Get the guassian stacks for the original image first
  • Each layer of the laplacian stack is the result of subtract two adjacent gaussian layers
  • The last layer is the last layer of the gaussian stack
  • Mask for the orange and apple are a 2d matrix with the same shape, and left half 0, and the other half 1, or vice versa

    General multiresolution process
  • calculate laplacian stacks for the images
  • calculate the guassian stacks for the masks
  • combine them for each level
  • add the laplacian stacks to get the final image
  • D_X
    D_y
    D_y
    D_X
    D_y
    D_y
    D_X
    D_y
    D_y
    D_X
    D_y
    D_y

    Lakers and moon

    D_X
    D_y
    D_y
    D_X
    D_y
    D_y
    D_X
    D_y
    D_y
    D_X
    D_y
    D_y