Perform morphological gradient.
The matrix img must be numeric whose gradients is calculated, while se_dil and se_ero are the structuring elements for the dilation and erosion respectively. They can be a:
The se_dil and se_ero default to the elementary cross, i.e.:
[ 0 1 0 1 1 1 0 1 0];
The basic morphological gradient corresponds to a matrix erosion subtracted to its dilation, which is equivalent to:
imdilate (img, se_dil) - imerode (img, se_ero)
To perform the half-gradients by erosion or dilation, or the internal or external gradients, simply pass an empty matrix as structuring element:
mmgradm (img, [], se_ero) # half-gradient by erosion or internal gradient mmgradm (img, se_dil, []) # half-gradient by dilation or external gradient
See also: imerode, imdilate, imopen, imclose, imtophat, imbothat.
Package: image