We define the translation and reflection of a set:
Ax | = | { c | c =a+x, a in A } |
= | { c | c-x in A } | |
B^ | = | { c | -c in B } |
The dilation of A by the structuring element B is
A + B | = | { x | B^x intersection A is empty } |
= | { x | there is c in A s.t. x-c in B } | |
= | Union(c in A) ( c + B ) |
The erosion of A by the structuring element B is
Theorem 1
(A - B)c | = | { x | Bx contained in A}c |
= | { x | Bx intersection Ac is empty }c | |
= | { x | Bx intersection Ac is not empty } | |
= | Ac + B^ |
The opening of A by the structural element B is defined as the dilation of the erosion of A:
A o B | = | (A - B) + B |
= | Union(c in A-B) ( c + B ) | |
= | Union(c | Bc contained in A) Bc | |
= | Union(Bc contained in A) Bc |
The closing of A by the structural element B is defined as the erosion of the dilation of A:
Theorem 2
( A * B )c | = | ( (A+B)-B)c |
= | (A + B)c + B^ | |
= | ( Ac - B^ ) + B^ | |
= | Ac o B^ |
Notice that only features smaller that the geometric size of the structuring element are affected by the morphological operations. The morphological operator have several properties:
A o B is contained in A |
A1 subset of A2 ==> A1 o B subset of A2 o B |
(A o B) o B = A o B |
A * B contains A |
A1 subset of A2 ==> A1 * B subset of A2 * B |
(A * B) * B = A * B |
The boundary of a set A with respect to the structuring element B is
DB A | = | A \ ( A - B ) |
= | { x in A | Bx is not contained in A } |
Region filling
Denote B4 the 4-connected (plus shaped) structuring element.
Let A be a 8-connected boundary contour, and P lies inside
the boundary. An algorithm to find the region inside the boundary is:
X0 | = | { P } |
Xk | = | ( Xk-1 + B4 ) intersection Ac |
Connected component extraction
Denote B8 the 8-connected (nine pixel square)
structuring element.
Let Y be a connected component and P belongs to Y.
An algorithm that extracts Y is as follows:
Y0 | = | { P } |
Yk | = | ( Yk-1 + B8 ) intersection A |
Medial Axis
For each P in A let B(P) =
{ x belonging to D A | d(X,P) is minimum}.
where d is the "distance".
The medial axis of A is
Skeleton
The skeleton of A with respect to the structuring element B is
defined as the union of the order-k skeletons:
S(A) | = | Unionk=0, ... Sk( A ) |
Sk(A) | = | (A -k B) \ ( (A -k B) o B) |
A -1 B | = | A - B |
A -k B | = | (A -k-1 B) - B |