Border treatment by imerode vs bwmorph(erode)

The two examples below show a case where the edge treatment during erosion seems to be different between imerode and bwmorph(erode). Matlab's documentation says that during erode operations, pad pixels are treated as MAX values to prevent border effects. imerode results below show that behavior, but the bwmorph('erode') results do not. Am I missing something?
>> imerode(ones(7,5), strel('square',3))
ans =
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
>> a = bwmorph(ones(7,5), 'erode')
a =
0 0 0 0 0
0 1 1 1 0
0 1 1 1 0
0 1 1 1 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
Thanks!

Respuestas (1)

J. Brady
J. Brady el 1 de Feb. de 2017

0 votos

As you said, imerode pads the input matrix with MAX values to prevent border effects. However, bwmorph (which uses bwlookup to preform the erosion) pads the input matrix with zeros. (see http://www.mathworks.com/help/images/morphological-dilation-and-erosion.html and https://www.mathworks.com/help/images/ref/bwlookup.html)

Etiquetas

Preguntada:

el 5 de Mzo. de 2013

Respondida:

el 1 de Feb. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by