# Edit Edit an Image Page: Image Convolution

You have to log in to edit pages.

To create an image page, simply complete the form below and then hit the 'Save Page' button at the bottom of the form. As you complete the form, remember that one of the main goals of the Math Images Project is to provide explanations of the images on our site at various levels, so that everyone can understand some of the math behind the images. Try to complete the form as fully as possible, but remember that other users will have the opportunity to add more information to your image pages in the future. Also, please note that by contributing to the Math Images Project, you agree to comply to the guidelines as stated in our general disclaimer.

As always, thank you for your contributions! --The Math Images Project

If you need help filling out this page, please consult our Help sections: Want to Contribute and Math Resources.

Note: * Indicates a required field.

Please note: When you are filling in the below explanations, you should feel free to use standard wikitext.

 Image Title*: Upload a Math Image 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. 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. Most generally, the convolution of two functions f and g is defined as the following: $(f * g)(x,y) = \sum_{v=-\infty}^{\infty} \sum_{u=-\infty}^{\infty} f(u,v) g(x - u, y - v)$ In this formula $f(x,y)$ is a function that represents the image, and $g(x,y)$ 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: $(f * g)(x,y) = \sum_{v=y-h}^{y+h} \sum_{u=x-w}^{x+w} f(u,v) g(x - u, y - v)$ Where $2w + 1$ is the width of the kernel and $2h + 1$ is the height of the kernel. In this example g is only defined over the points $[-w, w] \times [-h, h]$. 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: $\frac{1}{16} \left[ {\begin{array}{ccc} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \\ \end{array} } \right]$ 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: $\left[ {\begin{array}{ccc} 1 & 0 & -1 \\ 2 & 0 & -2 \\ 1 & 0 & -1 \\ \end{array} } \right]$ $\left[ {\begin{array}{ccc} 1 & 2 & 1 \\ 0 & 0 & 0 \\ -1 & -2 & -1 \\ \end{array} } \right]$ ==Separable Filters== ==Applet== {{SwitchPreview|ShowMessage=Click to show applet|hideMessage=Click to hide applet|PreviewText= |FullText= }} Algebra Analysis Calculus Dynamic Systems Fractals Geometry Graph Theory Number Theory Polyhedra Topology Other None Algebra Analysis Calculus Dynamic Systems Fractals Geometry Graph Theory Number Theory Polyhedra Topology Other None Algebra Analysis Calculus Dynamic Systems Fractals Geometry Graph Theory Number Theory Polyhedra Topology Other Yes, it is.