ImageConvolve

ImageConvolve[image,ker]
gives the convolution of image with kernel ker.

Details and OptionsDetails and Options

  • ImageConvolve[image,ker] by default gives an image of the same dimensions as image.
  • ImageConvolve works with 2D and 3D binary, grayscale, or multichannel images, operating separately on each channel.
  • The convolution kernel is given as a numerical matrix or as an image.
  • ImageConvolve takes a Padding option. The default setting is Padding->"Fixed".
  • With a setting Padding->None, ImageConvolve[image,ker] normally gives an image smaller than image.
  • ImageConvolve operates separately on each channel in an image.
  • ImageConvolve gives an image of a real type.

Background
Background

  • ImageConvolve performs the convolution operation on an image. Convolution is an integral (or its discrete analog) that expresses the amount of overlap of one function as it is shifted over another. Convolution therefore blends one function or image with another and can be used to perform many useful operations on images such as smoothing, feature extraction, and differentiation.
  • The smoothing function that is shifted over an image to perform convolution is a matrix known as a kernel, and many different kinds of kernels are possible and useful depending on context. GaussianFilter and MeanFilter are special cases of ImageConvolve that use a Gaussian and the mean value in a given range, respectively, as their kernels.
  • ImageConvolve is a local operation, meaning it produces output pixel values based only upon the pixel values in its neighborhood as determined by the kernel. It is also a linear one, meaning it is convolution-based and replaces each pixel by a linear combination of its neighbors.
  • The converse operation to ImageConvolve is ImageDeconvolve. The function ListConvolve performs the operation of convolution on lists (as opposed to images).

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Smooth an image by convolving with a square kernel:

In[1]:=
Click for copyable input
Out[1]=

Convolve a grayscale image with a Sobel mask to detect vertical edges:

In[1]:=
Click for copyable input
Out[1]=

Smooth a 3D image:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2008
(7.0)
| Updated in 2012
(9.0)