code for performing erosion and dilation without using builtin functions like imdilate or imerode??

13 vues (au cours des 30 derniers jours)
code for dilation and erosion without using builtin functions?
  3 commentaires
Walter Roberson
Walter Roberson le 8 Mar 2016
"aaa aaa" commented
then why u r having tis page ..better close it
Walter Roberson
Walter Roberson le 8 Mar 2016
"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.

Connectez-vous pour commenter.

Réponses (3)

aslan memo
aslan memo le 7 Nov 2019
if use this Structuring =[0 1 0;1 1 1;0 1 0]; how to write code ??

SIMI M S
SIMI M S le 23 Sep 2016
Modifié(e) : Walter Roberson le 23 Sep 2016
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 commentaires
Borhan Raad
Borhan Raad le 9 Août 2020
Modifié(e) : Walter Roberson le 9 Août 2020
does it work with 3x3 Structuring element? if not, what adjustment do we need to make?
Walter Roberson
Walter Roberson le 9 Août 2020
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);

Connectez-vous pour commenter.


Mohammed Hassan
Mohammed Hassan le 21 Fév 2022
code for dilation and erosion without using builtin functions ?

Community Treasure Hunt

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

Start Hunting!

Translated by