next up previous
Next: A Thinning Algorithm Up: morphology Previous: morphology

Morphology

Language of set theory

Let $Z$ denote the set of all integers, and $Z^2=Z\times Z$ denote the set of integer pairs $(i,j)\in Z^2$. The coordinates of a pixel $v[i][j]$ in an image can therefore be considered as a component of $Z^2$.

Let $A$ and $B$ be two white regions in a black and white binary image. Then they can be considered as two sets in $Z^2$ space, and their components $a=(a_1,a_2)\in A$ and $b=(b_1,b_2)\in B$ are just a pixel inside each of the regions.

In a binary image, an object of a certain shape can be represented by a set of either 4- or 8-connected white pixels in white background. To carry out certain operations on the shape of the object, the object and its back ground are mathematically represented as sets.

In general, a set is defined as a group of components all having certain properties or satisfying certain conditions:

\begin{displaymath}A=\{ a\;\vert\;\mbox{property(a)==TRUE} \} \end{displaymath}

Basic definitions:

morphology1.gif

Below, a structuring element $B$ is a binary object used in varioius morphology operators. All elements $b \in B$ are measured with respect to the origin $(0,0)$ located at the center of the object. For example, if $B$ is a $5\times 5$ square, then for any $b=(b_1,b_2)\in B$, $-2\le b_1,b_2,\le 2$.

Dilation


\begin{displaymath}D(A,B)=A\oplus B=\{ x\;\vert\;(\hat{B}_x \cap A) \ne \Phi \} \end{displaymath}

where $\Phi$ represents empty set. Alternatively,

\begin{displaymath}D(A,B)=A\oplus B=\bigcup_{b\in B} A_b=\bigcup_{a\in A} B_a \end{displaymath}

morphology2.gif

As typically the structuring element $B$ is symmetric (either central symmetric or symmetric with respect to its vertical or horizontal axis), the reflection part of the dilation definition will be dropped in the following.

constructing_elements_examples.gif

For these simplest structuring elements, dilation can be carried out by setting all background pixels (with value "0") 4- or 8-connected to each object pixel (with value "1") to the value "1".

Erosion


\begin{displaymath}E(A,B)=A\ominus B=\{ x\;\vert\;B_x \subseteq A \} \end{displaymath}

Alternatively,

\begin{displaymath}E(A,B)=A\ominus B=\bigcap_{b\in B} A_b \end{displaymath}

morphology3.gif

If the same simple structuring elements are used, erosion can be carried out by setting each object pixel (with value "1") 4- or 8-connected to a background pixel (with value "0") to the value "0".

morphology5.gif

Properties of dilation and erosion

Proof:

\begin{displaymath}(A\ominus B)^c=(\{x\;\vert\;B_x \subseteq A \})^c \end{displaymath}

Since set $B_x$ is contained in $A$, i.e., $B_x \subseteq A$, it has no overlap with the complement of $A$, i.e., $B_x \cap A^c=\Phi$, and the above equation can be written as:

\begin{displaymath}(A\ominus B)^c=(\{x\;\vert\;(B_x \cap A^c) = \Phi \})^c \end{displaymath}

But the complement of this set of all $x's$ satisfying the condition $B_x \cap A^c=\Phi$ is the set of all $x's$ not satisfying the condition, i.e.,

\begin{displaymath}(A\ominus B)^c=(\{x\;\vert\;B_x \cap \bar{A} = \Phi \})^c
=\{x\;\vert\;(B_x \cap A^c) \ne \Phi \}=A^c \oplus B \end{displaymath}

Taking complement on both sides above, and replacing $A$ by $A^c$, we get the second relation.

Opening

\begin{displaymath}O(A,B)=D(E(A,B),B),\;\;\;\;\;\;\;A \circ B=(A\ominus B)\oplus B \end{displaymath}

The opening of $A$ and $B$ is the dilation of the erosion of $A$ by $B$.

Closing

\begin{displaymath}C(A,B)=E(D(A,B),B),\;\;\;\;\;\;\;A \bullet B=(A\oplus B)\ominus B \end{displaymath}

The closing of $A$ and $B$ is the erosion of the dilation of $A$ by $B$.

Grayscale dilation and erosion

Morphological operations can be generalized to grayscale images. Here neither the image nor the structuring element is binary any more, and the Boolean operations (AND and OR, union and intersect) used for binary images are replaced by addition, subtraction, maximum and minimum operations.

DilationErosionCode.gif

Applications:

Example:

GumbyMorph.gif

morphology4.gif

morphology7.gif

morphology8.gif

Example:

MorphologyDemo.gif

Binary morpohology (top): original image, histogram, binary image (threshold 160), erosion, dilation;

Gray-scale morphology (bottom): original image, erosion, dilation, histogram, binary image (threshold 130).


next up previous
Next: A Thinning Algorithm Up: morphology Previous: morphology
Ruye Wang 2011-11-09