Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dilate/erode modify kernel option

I want to smooth the contour of binarized images and think that erode is the best way to do it. I know that normal way of work is use cvDilate(src, dst, 0, iter); where 0 is a 3x3 matrix.

Problem is 3x3 matrix makes a deep erode in my images. How can I do a erode with a 2x2 matrix or anything smaller than the default 3x3 matrix.

like image 994
Jorge Vega Sánchez Avatar asked Mar 01 '11 12:03

Jorge Vega Sánchez


People also ask

What is kernel in dilation?

The dilation operator takes two pieces of data as inputs. The first is the image which is to be dilated. The second is a (usually small) set of coordinate points known as a structuring element (also known as a kernel). It is this structuring element that determines the precise effect of the dilation on the input image.

What is dilation and erosion?

Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on object boundaries. The number of pixels added or removed from the objects in an image depends on the size and shape of the structuring element used to process the image.

What is erosion and dilation in OpenCV?

Erosion and Dilation are morphological image processing operations. OpenCV morphological image processing is a procedure for modifying the geometric structure in the image. In morphism, we find the shape and size or structure of an object.


1 Answers

Here you have for your reference the results of using different kernels:

enter image description here

Saludos!

like image 75
Dr. belisarius Avatar answered Oct 24 '22 14:10

Dr. belisarius