Image Convolution
Jamie Ludwig
Satellite Digital Image Analysis, 581
Portland State University
Key words
Filtering
Convolution
Matrix
Color
values
kernel
Spatial frequencies
Convolution filtering is used to modify the spatial frequency
characteristics of an image.
What is convolution?
Convolution is a general purpose filter effect for images.
Is a matrix applied to an image and a mathematical operation
comprised of integers
It works by determining the value of a central pixel by adding the
weighted values of all its neighbors together
The output is a new modified filtered image
The process of image convolution
A convolution is done by multiplying
a pixels and its neighboring pixels
color value by a matrix
Kernel: A kernel is a (usually) small
matrix of numbers that is used in
image convolutions.
Differently sized kernels
containing different patterns of
numbers produce different results
under convolution.
The size of a kernel is arbitrary
but 3x3 is often used
Example kernel:
0
Why convolve an image?
Smooth
Sharpen
Intensify
Enhance
Example
Original
image
Image with
color values
placed over it
164
188
164
178
201
197
174
168
181
Color values
Image with 3x3
kernel placed
over it
Output
image
Divided by the sum
of the kernel
932\5 = new
pixel color
Kernel
Convolution Formula
More examples
What do we do with edge pixels?
Wrap the image
Ignore edge pixels and only compute for those pixels with all
neighbors
Duplicate edge pixels so the pixel at (2,n) (where n would be nonpositive will have a value of (2,1)
-1 = no data
-1 -1 -1 -1 -1
1 1 1 1 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1 -1 -1 -1 -1
-1
1 1
1 1
Original Image
Smoothed modified
image
Some other kernel examples
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
Unweighted 3x3
smoothing kernel
Weighted 3x3 smoothing
kernel with Gaussian blur
Gaussian Blur
Kernel to make
image sharper
Intensified sharper
image
Sharpened image
Example of smoothing kernel
A larger kernel area when
using a smoothing kernel
increases smoothing area
5x5 smoothing
kernel
0
1
2
1
0
1
4
8
4
1
2
8
16
8
2
1
4
8
4
1
0
1
2
1
0
Main points
Start out with an image
The choice of kernel affects the output image
Base your choice of kernel on the desired results
for the image (smooth, blur, enhance, sharpen)
Low Pass and high pass filters will be discussed
later in the class
Pre-what?
Sources
http://www.dspguide.com/ch24/1.htm
http://wally.cs.iupui.edu/n351/raster/filterDemo.html
wally.cs.iupui.edu/n351/raster/filterDemo.html
http://www.websupergoo.com
Mather, P. M. 2004. Computer Processing of Remotely Sensed Images, An
Introduction. West Sussex. John Wiley & Sons Ltd.