code for performing erosion and dilation without using builtin functions like imdilate or imerode??
古いコメントを表示
code for dilation and erosion without using builtin functions?
3 件のコメント
John D'Errico
2016 年 3 月 5 日
編集済み: John D'Errico
2016 年 3 月 5 日
So write one. It is your homework after all. Why not make an effort. If and when you have a real question, then ask it.
Walter Roberson
2016 年 3 月 8 日
"aaa aaa" commented
then why u r having tis page ..better close it
Walter Roberson
2016 年 3 月 8 日
"aaa aaa": this facility exists to educate, not to do people's work for them.
When someone has a homework question, then at the very least we expect them to explain what it is they do not understand, at which point we will explain, or we will point them to appropriate documentation.
回答 (3 件)
aslan memo
2019 年 11 月 7 日
1 投票
if use this Structuring =[0 1 0;1 1 1;0 1 0]; how to write code ??
1 件のコメント
Walter Roberson
2019 年 11 月 10 日
How to write the code to accomplish what purpose?
SIMI M S
2016 年 9 月 23 日
編集済み: Walter Roberson
2016 年 9 月 23 日
Dilation code
A=imread( 'text.png' );
A=im2bw(A);
%Structuring element
B=[1 1 1 1 1 1 1;];
C=padarray(A,[0 3]);
D=false(size(A));
for i=1:size(C,1)
for j=1:size(C,2)-6
D(i,j)=sum(B&C(i,j:j+6));
end
end
figure,imshow(D);
3 件のコメント
Faiza Bukenya
2018 年 1 月 24 日
編集済み: Walter Roberson
2019 年 11 月 10 日
Erosion code
A=imread('faiza.png')
A=im2bw(A);
%Structuring element
B=[1 1 0];
%Pad array with ones on both sides
C=padarray(A,[0 1],1);
%Intialize the matrix D of size A with zeros
D=false(size(A));
for i=1:size(C,1)
for j=1:size(C,2)-2
L=C(i,j:j+2);
%Find the position of ones in the structuring element
K=find(B==1);
if(L(K)==1)
D(i,j)=1;
end
end
end
figure,imshow(D);
Borhan Raad
2020 年 8 月 9 日
編集済み: Walter Roberson
2020 年 8 月 9 日
does it work with 3x3 Structuring element? if not, what adjustment do we need to make?
Walter Roberson
2020 年 8 月 9 日
That code is only designed for linear structuring elements. The adjustment to it for a different width of linear structuring element would be
for j=1:size(C,2)-size(B,2)+1
L=C(i,j:j+size(B,2)-1);
Mohammed Hassan
2022 年 2 月 21 日
0 投票
code for dilation and erosion without using builtin functions ?
1 件のコメント
Image Analyst
2022 年 2 月 21 日
movmax() is dilation. movmin() is erosion.
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!