In this tutorial, we will see how to implement in
GLSL (
OpenGL Shading Language) the filters usually used in image processing:
blur (Gaussian Filter), de-dusting (Mean Filter), edegs detection (Laplacian Filter), emboss and sharpness. All these filters are
found in all image processing softwares (Photoshop, Paintshop Pro...).
The
convolution is an operation in which the final pixel is the weighted sum of the neighboring pixels.
This convolution operation is based on a
matrix which gives some weight to each one of the neighbor pixels.
This matrix is called
convolution kernel. This matrix is a square 3x3, 5x5 or 7x7 dimension matrix
(or more depending on filters). In this tutorial, we will use 3 dimension kernels.
The convolution kernel is also called
linear filter.
The various filters are implemented in GLSL, which is the shading language supported by
Demoniak3D.
Do not forget to download the latest version of Demoniak3D in order to be able to run each project.
The projects are downloadable at the end of this page.
The image which will be used to illustrate the operation of the various filters is the following one:
Fig.1 - Basic image.And now, let us see the filters codes.