Ask Your Question

What is `kernel`?

asked 2014-03-23 16:23:48 -0500

Luek gravatar image

I am looking to "smudge" text blocks together to create a blob. I have been told that I should look at the erode function. But the kernel parameter is giving me some issues, I am not sure what it represent or how I should use it. Could anyone explain it to me?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-03-24 01:34:00 -0500

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-03-23 16:23:48 -0500

Seen: 9,641 times

Last updated: Mar 24 '14