Mathematical morphology is a tool for extracting image components that are useful in the representation and description of region shapes, such as boundaries, skeletons, and convex hulls. Mathematical morphology is a set-theoretic method. Sets in mathematical morphology represent the shapes of objects in an image. The operations of mathematical morphology were originally defined as set operations and shown to be useful for image processing.
In general, morphological approach is based upon binary images. In binary images, each pixel can be viewed as an element in Z . Gray-scale digital images can be represented 2 as sets whose components are in Z , two components are the coordinates of a pixel, and the 3 third corresponds to its discrete intensity value. The morphological operations input a source image and a structuring element which is another image usually smaller than the source image.
The structuring element is a predetermined geometric shape, and there are some common structuring elements as shown in Fig. 2-16.
1
Fig. 2- 16 Examples of structuring elements
Here, we will discuss morphological operators in binary images [25, 26]. Given a source image A and a structuring element B in Z . 2
2.4.1 Basic definition
The Translation of A by the point x in Z , denoted 2 Axv, is defined by
{
|}
Axv = av v+x ∀ ∈av A = +A xv (2.25) where the plus sign refers to vector addition.
And the Reflection of B, denoted Bˆ , is defined as
{
|}
B= −b bv v∈B (2.26) The examples of Translation and Reflection are shown in Fig. 2-17.
A xv
x B Av
(a) (b)
Bˆ
Fig. 2- 17 Examples of (a) Translation and (b) Reflection
2.4.2 Morphological operations
Here, we introduced two of the fundamental morphology operations:Dilation and Erosion used in binary images, and introduced two operators:Closing and opening that extended from Dilation and Erosion.
2.4.2.1 Dilation and Erosion
The Dilation of A by B, denoted DB
( )
A , is defined as( )
ˆ{
| ˆ}
DB A = ⊕ =A B x Bv + ∩ ≠xv A φ (2.27) Where B is the structuring element.
And the Erosion of A by B, denoted EB
( )
A , is defined asThe examples of Dilation and Erosion are shown in Fig. 2-18 (c) and (d). The dilation of A by B is the set of all xv displacements such that Bˆ and A overlap by at least one nonzero element. The erosion of A by B is the set of all points xv such that B translated by xv is contained in A.
2.4.2.2 Closing and Opening
The Closing of set A by structuring element B, denoted CB
( )
A , is defined as( )
ˆ( ( ) ) (
ˆ)
ˆB B B
C A = • =A B E D A = A⊕ 0B B (2.29) And the Opening of set A by structuring element B, denoted OB
( )
A , is defined as( )
ˆ( ( ) ) ( )
B B
O A = A Bo =DB E A = A B0 ⊕B (2.30) The examples of Closing and Opening are shown in Fig. 2-18 (e) and (f). The closing of A by B is simply the dilation of A by B, followed by the erosion of the result by Bˆ . The opening of A by B is simply the erosion of A by B, followed by the dilation of the result by Bˆ .
(a). Set A (b). Structuring element B
(c). Dilation (d). Erosion
(e). Closing (f). Opening
Fig. 2- 18 (a). Set A. (b) Structuring element B.
(c). The Dilation of A by B. (d). The Erosion of A by B.
(e). The Closing of A by B. (f). The Opening of A by B.
2.4.3 Extension to Gray-Scale Images
In this section we extend to gray-level images the basic operations of dilation, and erosion. Throughout the discussions that follow, we deal with digital image functions of the forms f x y and( , ) b x y( , ), where f x y is the gray-scale image and( , ) is a structuring element.
( , ) b x y
Gray-Scale dilation of f by , denoted by b f ⊕ , is define as:b
( )( , ) max{ ( , ) ( , ) ( ), ( ) ;( , ) } (2.31)
f b
f ⊕b s t = f s−x t−y +b x y s−x t− ∈y D x y ∈D
element of the morphological process but note that b is now a function rather than a set.
Because dilation is based on choosing the maximum value of f + b in a neighborhood defined by the shape of the structuring element, the general effect of performing dilation on a gray-scale image is two-fold: (1) if all the values of the structuring element are positive, the output image tends to be brighter than the input; and (2) dark details either are reduced or eliminated, depending on how their values and shapes relate to the structuring element used for dilation. As illustrated in Fig 2-19 (b).
Gray-scale erosion of f by , denoted by b f0 , is define as: b
(f0b s t)( , ) min{ (= f s+x t, +y)−b x y( , ) (s+x), (t+y)∈Df;( , )x y ∈Db}
Db
(2.32)
Where Df and are the domain of f and b . Because erosion is based on choosing the minimum values of f b− in a neighborhood defined by the shape of the structuring element, the general effect of performing erosion on a gray-scale image is two-fold: (1) if all the values of the structuring element are positive, the output image tends to be darker than the input; and (2) bright details are reduced or eliminated, depending on the used structuring element. As illustrated in Fig 2-19 (c).
(a ) (b ) (c )
Fig. 2- 19 (a) The original of Lena image (b) Dilation of Lena image
(c) Erosion of Lena image
The usage of closing and closing is to smooth contours of objects. In gray-level images, closing is used for brighter objects with darker background, and opening is used for darker object objects with brighter background. As illustrated in Fig 2-20 (b) and (c).
(a ) (b ) (c )
Fig. 2- 20 (a) The original of Lena image
(b) Closing of Lena image
(c) Opening of Lena image
2.4.4 Morphological Gradient
The Morphological Gradient of an image, denoted G:
( ) ( ) ( ) ( )
B B
G=D A −E A = A⊕B − 0A B (2.33) or
( ) ( )
(2.34) G=DB A − =A A⊕B −Aor
( ) ( )
(2.35) G= −A EB A = − 0A A BThe morphological gradient highlights sharp gray-scale transitions in the source image. In other words, morphological gradient can extract the boundary of an object. However, the morphological gradient is sensitive to the shape of the chosen structuring element. Here are examples of dilation, erosion, closing, opening, and morphological gradient of the gray-scale
image, Lena, with the 3×3 structuring element as shown in Fig 2-21.
(a ) (b )
Fig. 2- 21 (a) The original of Lena image (b) Morphological gradient of Lena image
CHAPTER 3 The Proposed Method
In this chapter, we will introduce the architecture of the inpainting system based on the proposed method. We focus on these images with several small and large damaged regions, such as the image shown in Fig. 3-1. The goal of this paper is to effectively and correctly inpaint these damaged images. It is known that “Fast Digital Image Inpainting” [2] can fast inpaint small damaged regions, but it can’t work well for large damaged regions. “Priority Texture Synthesis” [7] can both inpaint small and large damaged regions well, but it spend too much time. Therefore, we propose a new inpainting method that will combine “Fast Digital Image Inpainting” and “Priority Texture Synthesis”. In section 3.1, we will discuss the process of our image inpainting. In section 3.2, we will utilize morphological operations to
automatically split the damaged regions into several small and large parts. In section 3.3, we will modify the “Fast Digital Image Inpainting” algorithm and then apply it to inpaint these small damaged parts. In section 3.4, we will apply the “Priority Texture Synthesis” algorithm to inpaint these large damaged parts and add the FFT block matching algorithm to speedup the time of searching similar textures. Finally, we will summarize the proposed method in Section 3.5.