Multiscale dilation:structure unit does not change after imdilate by itself. What the multiscale dilation meaning?

1 回表示 (過去 30 日間)
g=[0 1 0;0 1 0;0 1 0];
n=3;
ng=g;
for i=1:n
ng=imdilate(ng,g)
end
  1 件のコメント
DGM
DGM 2021 年 11 月 27 日
The strel has a width of 1px. Dilation with a 1px strel does no change.
A = zeros(5);
A(3,3) = 1
A = 5×5
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
imdilate(A,1)
ans = 5×5
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

サインインしてコメントする。

回答 (1 件)

Prachi Kulkarni
Prachi Kulkarni 2021 年 12 月 1 日
編集済み: Prachi Kulkarni 2021 年 12 月 2 日
Hi,
As per the definition of dilation described at the end of the documentation on imdilate, the structural element g when operated on the matrix ng should not lead to any change in the matrix ng.
This is not generally true. It is applicable to your particular definitions of the variables g and ng.
  2 件のコメント
DGM
DGM 2021 年 12 月 1 日
編集済み: DGM 2021 年 12 月 1 日
That's obviously not generally true. It's only true in this case because a 1px strel can intersect (sample) no more than a trivial neighborhood .
g = ones(1);
n = 3;
ng = padarray(g,[5 5],0,'both');
for i=1:n
ng = imdilate(ng,g);
end
ng
ng = 11×11
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
A wider strel would effect a change.
g = ones(3);
n = 3;
ng = padarray(g,[5 5],0,'both');
for i=1:n
ng = imdilate(ng,g);
end
ng
ng = 13×13
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0
It is perhaps worth pointing out that OP's strel is taller than 1 and will dilate vertically. It's just that the output size is constrained such that it never has any effect.
g = ones(3,1);
n = 3;
ng = padarray(g,[5 5],0,'both');
for i=1:n
ng = imdilate(ng,g);
end
ng
ng = 13×11
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
DGM
DGM 2021 年 12 月 2 日
I'm sorry. I trust you know that. I just wanted to make sure that OP or a future reader didn't misinterpret it that way, and used the opportunity to elaborate on my own prior comments.

サインインしてコメントする。

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by