0% found this document useful (0 votes)
205 views23 pages

Convolution

1) Gaussian filtering smooths an image by applying a Gaussian kernel that gives less weight to pixels further from the center. This reduces noise and detail. 2) Convolving an image with derivative filters like the Laplacian of Gaussian (LoG) detects edges by finding zero crossings in the second derivative. The LoG approximates the ideal edge detection operator. 3) Blurring an image with a Gaussian filter removes high frequency details like edges before subtracting the blurred version from the original, enhancing edges through subtraction. This is the basis for unsharp masking.

Uploaded by

subbu2051
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
205 views23 pages

Convolution

1) Gaussian filtering smooths an image by applying a Gaussian kernel that gives less weight to pixels further from the center. This reduces noise and detail. 2) Convolving an image with derivative filters like the Laplacian of Gaussian (LoG) detects edges by finding zero crossings in the second derivative. The LoG approximates the ideal edge detection operator. 3) Blurring an image with a Gaussian filter removes high frequency details like edges before subtracting the blurred version from the original, enhancing edges through subtraction. This is the basis for unsharp masking.

Uploaded by

subbu2051
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Convolution and Edge Detection

Some slides from Steve Seitz

15-463: Computational Photography Alexei Efros, CMU, Fall 2005

Fourier spectrum

Fun and games with spectra

Gaussian filtering
A Gaussian kernel gives less weight to pixels further from the center of the window
0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 90 0 0 90 90 0 0 90 90 0 0 90 90 0 0 90 90 0 0 0 0 0 0 0 0 1 2 1 2 4 2 1 2 1

0
0 0 0 0 0

0
0 0 0 0 0

0
0 0 0 90 0

90
90 90 0 0 0

90
0 90 0 0 0

90
90 90 0 0 0

90
90 90 0 0 0

90
90 90 0 0 0

0
0 0 0 0 0

0
0 0 0 0 0

This kernel is an approximation of a Gaussian function: 4

Mean vs. Gaussian filtering

Convolution
Remember cross-correlation:

A convolution operation is a cross-correlation where the filter is flipped both horizontally and vertically before being applied to the image:

It is written:

Suppose H is a Gaussian or mean kernel. How does convolution differ from cross-correlation?

The Convolution Theorem


The greatest thing since sliced (banana) bread! The Fourier transform of the convolution of two functions is the product of their Fourier transforms

F[g h] F[g ] F[h]


The inverse Fourier transform of the product of two Fourier transforms is the convolution of the two inverse Fourier transforms

F [ gh] F [ g ] F [h]
Convolution in spatial domain is equivalent to multiplication in frequency domain!

Fourier Transform pairs

2D convolution theorem example


|F(sx,sy)|

f(x,y)

*
h(x,y) |H(sx,sy)|

g(x,y)

|G(sx,sy)|

Edges in images

Image gradient
The gradient of an image:

The gradient points in the direction of most rapid change in intensity

The gradient direction is given by:

how does this relate to the direction of the edge?

The edge strength is given by the gradient magnitude

Effects of noise
Consider a single row or column of the image
Plotting intensity as a function of position gives a signal

How to compute a derivative?

Where is the edge?

Solution: smooth first

Where is the edge? Look for peaks in

Derivative theorem of convolution


This saves us one operation:

Laplacian of Gaussian
Consider

Laplacian of Gaussian operator

Where is the edge?

Zero-crossings of bottom graph

2D edge detection filters

Laplacian of Gaussian

Gaussian

derivative of Gaussian

is the Laplacian operator:

MATLAB demo
g = fspecial('gaussian',15,2); imagesc(g) surfl(g) gclown = conv2(clown,g,'same'); imagesc(conv2(clown,[-1 1],'same')); imagesc(conv2(gclown,[-1 1],'same')); dx = conv2(g,[-1 1],'same'); imagesc(conv2(clown,dx,'same'); lg = fspecial('log',15,2); lclown = conv2(clown,lg,'same'); imagesc(lclown) imagesc(clown + .2*lclown)

What does blurring take away?

original

What does blurring take away?

smoothed (5x5 Gaussian)

Edge detection by subtraction

Why does this work?

smoothed original

Gaussian - image filter

FFT

Gaussian

delta function

Laplacian of Gaussian

What is happening?

Unsharp Masking
100 200 300 400 500 200 400 600 800

+a

You might also like