Image Convolution
Image Convolution |
---|
Image Convolution
- Image Convolution is the process of applying a filter to images. Clockwise from top left, this images shows an original image, a Gaussian Blur filter, a Poster Edges filter, and a Sharpen filter. The filters were applied in Photoshop.
Contents
Basic Description
Images can be convolved by applying a function to each pixel of the image. Usually, this function is precalculated inside a small two dimensional array called a kernel.
A More Mathematical Explanation
Most generally, the convolution of two functions f and g is defined as the following:
'"`UNIQ--mat [...]Most generally, the convolution of two functions f and g is defined as the following:
In this formula is a function that represents the image, and is the kernel. In practical situations, the kernel is only defined over a finite set of points, so we can modify our definition as follows:
Where is the width of the kernel and is the height of the kernel. In this example g is only defined over the points . To convolve an image, this formula is evaluated at every point in the image. In the following pseudocode to convolve an image, f(x, y) is the original image, g(x, y) is the kernel, and h(x, y) is the new image.
for y from 0 to imageHeight for x from 0 to imageWidth sum := 0; for v from y - h to y + h for u from x - w to x + w sum := sum + f( u, v ) * g( x - u, y - v ); h( x, y ) := sum;
Examples
The most common type of kernel is a gaussian which acts as a lowpass filter, suppressing high frequency data in the signal. The most common example of the gaussian for a 3x3 kernel is the following:
Other types of filters include edge detectors, which are essentially high pass filters. One type of edge detectors is called the Sobel operator. Mathematically, it computes the first derivative. The first derivative is large when the image greatly increases in intensity between two adjacent points which is what an edge looks like. The sobel operator has the form:
Separable Filters
Applet
ERROR: Unable to find Java Applet file: ImageConvolution2.class.
Teaching Materials
- There are currently no teaching materials for this page. Add teaching materials.
Leave a message on the discussion page by clicking the 'discussion' tab at the top of this image page.
[[Category:]]