Mercurial > hg > octave-image
changeset 479:c88e984fd5d1
bwmorph: use package functions rather than re-implementing operation
author | carandraug |
---|---|
date | Mon, 31 Oct 2011 12:50:48 +0000 |
parents | 0f9b9dd64b9c |
children | ed19b5ad9718 |
files | inst/bwmorph.m |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/inst/bwmorph.m +++ b/inst/bwmorph.m @@ -184,7 +184,7 @@ ## W. K. Pratt, "Digital Image Processing" ## Gonzalez and Woods, "Digital Image Processing" ## -## @seealso{dilate, erode, makelut, applylut} +## @seealso{imdilate, imerode, imtophat, makelut, applylut} ## @end deftypefn @@ -214,8 +214,8 @@ switch(operation) case('bothat') - se=ones(3); - BW2=erode(dilate(BW, se), se)-BW; + se = ones(3); + BW2 = imtophat (BW, se, 'close'); if(n>1) ## TODO: check if ignoring n>1 is ok. Should I just ignore it ## TODO: without a warning? @@ -266,8 +266,8 @@ return; case('close') - se=ones(3); - BW2=erode(dilate(BW, se), se); + se = ones(3); + BW2 = imclose (BW, se); if(n>1) ## TODO: check if ignoring n>1 is ok. disp("WARNING: n>1 has no sense here. Using n=1. Please fill a bug if you think this behaviour is not correct"); @@ -297,10 +297,10 @@ case('dilate') - cmd="BW2=dilate(BW, ones(3));"; + cmd="BW2=imdilate(BW, ones(3));"; case('erode') - cmd="BW2=erode(BW, ones(3));"; + cmd="BW2=imerode(BW, ones(3));"; case('fill') ## lut=makelut(inline("x(2,2)||(sum((x&[0,1,0;1,0,1;0,1,0])(:))==4)","x"),3); @@ -349,8 +349,8 @@ cmd="BW2=applylut(BW, lut);"; case('open') - se=ones(3); - BW2=dilate(erode(BW, se), se); + se = ones(3); + BW2 = imopen (BW, se); if(n>1) ## TODO: check if ignoring n>1 is ok. disp("WARNING: n>1 has no sense here. Using n=1. Please fill a bug if you think this behaviour is not correct"); @@ -527,8 +527,8 @@ case('tophat') - se=ones(3); - BW2=BW-dilate(erode(BW, se), se); + se = ones(3); + BW2 = imtophat (BW, se, 'open'); if(n>1) ## TODO: check if ignoring n>1 is ok. disp("WARNING: n>1 has no sense here. Using n=1. Please fill a bug if you think this behaviour is not correct");