# Convolution (computer science)

*457*pages on

this wiki

Basically a convolution in digital image processing is a weighted sum, which is computed for each pixel of image:

result=sum(k[n,p]*I[x,y]).

Important things: 1) form and size of window, which moves over image; 2) numbers k[n,p] in all positions [n,p] inside window, which represent impulse response of filter; 3) numbers I[x,y] under window - intensities of pixels[x,y]. For low frequency filter (sum(k[n,p]) >0; each k[n,p]>=0) numbers k[n,p] must be normalised by dividing on a sum(k[,n,p]) - example 1. For high frequency filter sum(k[n,p]) =0 and some of k[n,p] are negative, whilst others are positive. Sharping filter is like high frequency filter, but sum(k[n,p]) >0.

Examples of window:

1) low frequency filter - image smoothing

[1 1 1

1 1 1

1 1 1]

after normalisation

[1/9 1/9 1/9

1/9 1/9 1/9

1/9 1/9 1/9]

2) high frequency filter - gives horizontal contours (north-south)

[1 1 1

0 0 0

-1 -1 -1]

3) sharping filter

[-1 -1 -1

-1 9 -1

-1 -1 -1].