Ask Your Question
0

Morphological Filtering On OpenCV

asked 2017-05-13 10:32:24 -0600

Kenny Karnama gravatar image

updated 2017-05-15 00:53:47 -0600

Hi guys, i want to ask about this statement :

3 x 3 disk morphological filtering

Does it mean the radius is 9 ? or the size = 2 * 3 - 1 ?

Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-05-15 01:47:12 -0600

berak gravatar image

no, the radius is (size-1)/2 .

here is the 3x3 disk kernel, as you can see, it's pretty much the same as the MORPH_CROSS one, because it's so small:

Mat k = getStructuringElement(MORPH_ELLIPSE,Size(3,3));
cerr << k << endl;


[  0,   1,   0;
   1,   1,   1;
   0,   1,   0]

ofc., it gets more "disk-like" with larger size (like 11):

[  0,   0,   0,   0,   0,   1,   0,   0,   0,   0,   0;
   0,   0,   1,   1,   1,   1,   1,   1,   1,   0,   0;
   0,   1,   1,   1,   1,   1,   1,   1,   1,   1,   0;
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1;
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1;
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1;
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1;
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1;
   0,   1,   1,   1,   1,   1,   1,   1,   1,   1,   0;
   0,   0,   1,   1,   1,   1,   1,   1,   1,   0,   0;
   0,   0,   0,   0,   0,   1,   0,   0,   0,   0,   0]

please also see MORPH flags and tutorials

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-13 10:32:24 -0600

Seen: 238 times

Last updated: May 15 '17