In mathematical morphology and digital image processing, a morphological gradient is the difference between the dilation and the erosion of a given image. It is an image where each pixel value (typically non-negative) indicates the contrast intensity in the close neighborhood of that pixel. It is useful for edge detection and segmentation applications.
Let
f:E\mapstoR
b(x)
b(x)=\left\{\begin{array}{ll}0,&|x|\leq1,\\-infty,&otherwise\end{array}\right.
Then, the morphological gradient of f is given by:
G(f)=f ⊕ b-f\ominusb
where
⊕
\ominus
An internal gradient is given by:
Gi(f)=f-f\ominusb
and an external gradient is given by:
Ge(f)=f ⊕ b-f
The internal and external gradients are "thinner" than the gradient, but the gradient peaks are located on the edges, whereas the internal and external ones are located at each side of the edges. Notice that
Gi+Ge=G
If
b(0)\geq0