Fun with Filters and Frequencies

Project2 By Fan Du

Highpass and lowpass filter could be used for edge detection, sharpen image, hybrid images and blend images.

Part1 Edge Detection

To detect the edge of a cameraman image, it is first convolve with finite difference operators D_x and D_y.

dxdy

Then, we use below formula to compute gradient magnitude image. And set threshold=0.14 to change it into edge image.

(1)image_gradient=image_dx2+image_dy2

21

However, we could see that the edge image is rather noisy. Using Gaussian filter to blur the image first is a effective way to make it better, because it flite the high frquency noise. The edge of DoG is more distinct and thicker than previous one.

22

Except blur the image first, we could convolve gaussian filter with D_x and D_y first, and use it to filte the image. The result is same.

22.0

download (1)

Part2

2.2 Sharpen Images

Based on the formula below, we can create a sharpen core. f is the original image, e is an unit impulse, g is a gaunssian core.

(2)f+α(ffg)=f((1+α)eαg)

221

223

222

2.3 Hybrid Images

To hybrid images, we use low-pass filter to one image, high-pass filter the second image, and add the two images.

  1. Baby vs elder

    baby

    elder

    1

    2

    4

  2. man vs cat

cat

ppl

Figure_12

Figure_1_副本

Figure_3

Figure_1

sharp

Gaussian_Mask

Hybrid

  1. Harris vs Trump

harris

trump

H1

H2

H3

2.3 & 2.4 Blend images

Multiresolution blending is a technique used to seamlessly blend two images by utilizing Gaussian and Laplacian pyramids. The method allows for smooth transitions between images by blending them at multiple frequency bands.

  1. apple vs orange

orange

apple

gaussin_stack

Lap_stack

Orapple

  1. Sky vs Ship

    ship

ship

shipmask

ship_sky

  1. UCB vs Stanford

    icon2

    icon1

icons

icons