What is a convolution matrix? It’s possible to get a rough idea of it without using mathematical tools that only a few ones know. Convolution is the treatment of a matrix by another one which is called “kernel”.

The Convolution Matrix filter uses a first matrix which is the Image to be treated. The image is a bi-dimensional collection of pixels in rectangular coordinates. The used kernel depends on the effect you want.

We will consider only 3×3 matrices, they are the most used and they are enough for all effects you want. If all border values of a kernel are set to zero, then system will consider it as a 3×3 matrix.

The filter studies successively every pixel of the image. For each of them, which we will call the “initial pixel”, it multiplies the value of this pixel and values of the 8 surrounding pixels by the kernel corresponding value. Then it adds the results, and the initial pixel is set to this final result value.

convolution kerneljust as a quick reminder, a set of convolution kernels.

Mean:

1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9

Sharpen:

0 -1 0
-1 5 -1
0 -1 0

Blur:

1 1 1
1 1 1
1 1 1

Motion blur:

1 0 0
0 1 0
0 0 1

Sharpen:

-1 -1 -1
-1 9 -1
-1 -1 -1

Boost edges:

1 1 1
1 7 1
1 1 1

Edge enhance:

0 0 0
-1 1 0
0 0 0

Edge detect:

0 1 0
-1 -4 1
0 1 0

Emboss:

-2 -1 0
-1 -1 1
0 1 2

Related Blogs

  • Related Blogs on