File Exchange

image thumbnail

mdilate

version 1.0 (2.05 KB) by

This has 2 files mdilate.m(performs dilation of image) and merode.m(performs erosion on image).

1 Download

Updated

No License

MDILATE Perform dilation on binary(2) or gray(256) image. newI = mdilate(Image,Se,Ap,Method) performs dilation on the image Image, using the binary structuring element Se. Se is a matrix containing only 1's and 0's. Ap is the active pointpoint in the Se Matrix, which define the point to dilate. Method is a string that can have one of these values:
 
'binary' - processes the binary image
'gray' - processes the gray image

mErode Perform erosion on binary(2) or gray(256) image. newI = merode(Image,Se,Ap,Method) performs erosion on the image Image, using the binary structuring element Se. Se is a matrix containing only 1's and 0's. Ap is the active point in the Se Matrix, which define the point to erode. Method is a string that can have one of these values:
 
'binary' - processes the binary image
'gray' - processes the gray image

Comments and Ratings (2)

Andr?

Andr? (view profile)

The core of the merode algorithm should be:
if( Se(m,n)~=0 && tmp1>0 && tmp2>0 && tmp1<=Isize(1,1) && tmp2<=Isize(1,2) )
         if (Image(tmp1,tmp2)~= 1)

otherwise any erosion-kernel with zeros in it will erode away everything but exact copies of the kernel.

Markus Karlsson

Four nested for-loops don't provide an efficient algorithm, sorry.

MATLAB Release
MATLAB 5.2 (R10)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video