IMDILATE - similar kind of loop need to be generated - HELP required

조회 수: 1 (최근 30일)
Sriram
Sriram 2012년 9월 5일
Hi,
I am trying to make a loop that should work Similar to IMDILATE - a step before it gives the result for each pixel. If you look into the sample code below, you could understand more clear way
a = [1 2 3 ; 4 5 6 ; 7 8 9 ] % input
b = ones(3,3) % say it to be struct element
nw = b;
for i = 1:3;
for j = 1:3;
if (i == 1 && j ==1)
for m = 1:2;
for n = 1:2;
nw (m+1,n+1) = a(m,n);
end
end
elseif (i == 1 && j == 2)
nw = b;
for m = 1:2;
for n = 1:3;
nw (m+1,n)= a(m,n);
end
end
elseif (i == 1 && j ==3)
nw =b;
for m = 1:2;
for n = 1:2;
nw (m+1,n) = a(m,n+1);
end
end
else
break;
end
display(nw);
end
end
Now variable nw displayed for the first row elements 1 2 3 .. in similar way I need your help to make it for 2 and 3 row too and also in a more generic way ... say my input and strel may vary on rows n columns (not fixed to (3,3))
Thanks in advance

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by