Image Kernels and Convolution (Linear Filtering)

This Demonstration shows how the convolution operation can be used in conjunction with a 3×3 kernel to modify an image linearly.
The controls at the top are used to define the coefficients of the kernel to apply to the image through a convolution operation. The "examples" controls show some common configurations of kernels; the "random" button gives a pseudorandom filter. You can vary the values of the "kernel matrix" to test new configurations.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


The discrete convolution operation is defined as:
where is the original image, is the transformed (or filtered image), is the kernel to be applied to the image, and are the coordinates of the pixels.
Suppose an image has the grayscale pixel values and we want to transform by a kernel .
The value of the pixel at on the converted image is .
This operation of "masking" the image's pixels with the kernel values is repeated for every value of the image to obtain the transformed image .
In image processing applications, masking implements linear filters; the kernels are the "recipes" from which the transformed images get their properties.
[1] W. Burger and M. J. Burge, Principles of Image Processing: Fundamental Techniques, New York: Springer 2009.
[2] W. Burger and M. J. Burge, Principles of Image Processing: Core Algorithms, New York: Springer, 2011.
[3] R. Szeliski, Computer Vision: Algorithms and Applications, New York: Springer, 2010.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2017 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+