Ask Your Question

Revision history [back]

Hi Luek,

Don't let esoteric names, such as kernel, intimidate you :) The concept behind it is really simple.

That kernel (also known as structuring element) is nothing else but a binary matrix, that is: a matrix composed by 0's and 1's. The arrangement of those 0's and 1's will determine the neighborhood of pixels over which the minimum (in the case of erode) or maximum (in the case of dilate) is taken.

The erode function will slide the kernel over the original image and all the pixel values on the original image that "fall under" a 1 value on the kernel will be considered for the calculation of the minimum value.

To make things easy, OpenCV provides the function getStructuringElement.

You can also take a look at this wikipedia article: Erosion

I hope this helps