# An Automatic Image Inpainting Algorithm Based on FCM

Authors: Jiansheng Liu; Hui Liu; Shangping Qiao; Guangxue Yue
Journal: The Scientific World Journal
 (2014)

---

## Abstract

There are many existing image inpainting algorithms in which the repaired area should be manually determined by users. Aiming at this drawback of the traditional image inpainting algorithms, this paper proposes an automatic image inpainting algorithm which automatically identifies the repaired area by fuzzy C-mean (FCM) algorithm. FCM algorithm classifies the image pixels into a number of categories according to the similarity principle, making the similar pixels clustering into the same category as possible. According to the provided gray value of the pixels to be inpainted, we calculate the category whose distance is the nearest to the inpainting area and this category is to be inpainting area, and then the inpainting area is restored by the TV model to realize image automatic inpainting.


---

## Body

## 1. Introduction

Inpainting is a trimming process for the defects and cracks of the art, originated from the art field which was originally the heritage restoration of experts on the basis of being faithful to the original. Image inpainting is a technology for restoring the damaged parts of an image by referring to the information from the undamaged parts to make the restored image look “complete”, “continuous” and “natural”.The terminology “digital image inpainting” was firstly put forward on the international conference in Singapore in 2000. There are many typical image inpainting algorithms proposed by researchers during the past decade. The BSCB [1] model was presented by Bertalmio, Sapiro, Caselles, and Ballester. The TV (total variation) model [2, 3] was proposed by Chan and his team. The CDD (curvature driven diffusions) model [4, 5] was introduced by Chan T. and Shen J. An isotropic diffusion of fast image inpainting was proposed by Oliverira. A model based on RBF was proposed by Zhou et al. [6]. The p-Laplace inpainting model was calculated from p-Laplace operator by Zhang et al. [7–9]. Wang et al. proposed a new spread function to improve the TV model [10], algorithm based on wavelet decomposition was proposed by Zhang and Dai [11] and so forth. However, these models belong to semi-automatic image restoration algorithms that need to manually determine the repaired area. It is a difficult problem for automatically identifying the repaired area of the image and achieving automatically image inpainting function in the field of image inpainting.This paper attempts to overcome this drawback of the traditional image inpainting techniques to a certain degree. The proposed algorithm utilizes the fuzzy C-means (FCM) clustering algorithm to automatically identify the damaged area and also combines the TV model to realize image automatic inpainting.


## 2. Theoretical Basis of FCM Identify Damaged Areas

### 2.1. Basic Knowledge of the Fuzzy Sets

Fuzzy set theory and fuzzy logic [12] are presented by Zadeh, that is, to use precise methods, formulas, and models to measure and handle phenomena and rules which are vague, incomplete, or incorrect. Membership function is defined as the degree to which an object x belongs to a fuzzy set A, usually recorded as u
A
(
x
); the scopes of its argument are the all possible objects which belongs to the set A (that all the points of the space where the set A in) in the range of [
0
,
1
]; namely, 0
≤
u
A
(
x
)
≤
1. u
A
(
x
)
=
1 means that x completely belongs to set A, which is equivalent to the traditional set concept x
∈
A. A membership function defined in the space of X
=
{
x
} is defined as a fuzzy set A, or defined as fuzzy subset A in the domain of X
=
{
x
}. For the fuzzy set A
~ which has finite objects x
1
,
x
2
,
…
,
x
n can be expressed as
(1)
A
~
=
{
(
μ
A
(
x
i
)
,
x
i
)
∣
x
i
∈
X
}
.Fuzzy set theory has played an important role in many applications, such as fuzzy clustering analysis, fuzzy pattern recognition [13], fuzzy synthetic judgments [14], fuzzy decision and forecast [15, 16], fuzzy programming, fuzzy probability [17], and fuzzy statistics [18]. In the problem of clustering, the clusters generated by clustering can be regarded as fuzzy sets; therefore, the value of membership of each sample point belongs to a cluster that is in the interval [
0
,
1
].


### 2.2. Theory of FCM Algorithm

Fuzzy C-mean clustering (FCM) [19, 20] is a clustering algorithm that uses membership to determine the degree of each data point which belongs to a cluster. In 1973, Bezdek proposed the algorithm that is an improved algorithm of the early hard C-means clustering (HCM). The fuzzy clustering algorithm uses the initialization method to determine several initial clustering centers and then performs a repeated iteration which continuously adjusts and optimizes the clustering centers to achieve the minimal variance within clusters. It is a method based on the principle of least squares using iterative methods to optimize objective function to get the fuzzy partition of the data sets. Its objective function is defined as
(2)
min
J
FCM
(
U
,
V
)
=
∑
k
=
1
n
∑
i
=
1
c
u
i
k
m
d
i
k
2
,
where X
=
{
x
1
,
x
2
,
…
,
x
n
}
∈
R
n
×
p is a data set that composed of n samples of dimension p, which is divided it into C classes. x
k is a p-dimensional vector; m
∈
[
1
,
∞
) is the weighted index; when m
=
1, the fuzzy C-means clustering is degraded as the classical C-means clustering. Nikhil et al. studies show that the best choice for m is in range of [
1.5
,
2.5
] and its ideal value is usually set to m
=
2; d
i
k is generally defined as the Euclidean distance, it means the distance between sample x
k and center v
i, that is, d
i
k
=
∥
x
k
-
v
i
∥
A, ∥
·
∥
A  defines as norm of A, usually A
=
2; that is, d
i
k is 2-norm; V
=
{
v
1
,
v
2
,
…
,
v
c
}
∈
R
c
×
p is the set of c cluster centers. v
i is p-dimensional vector and denotes the i
th cluster center; u
i
k is the membership of the k
th pixel that belongs to i
th class. Therefore, the classification results can be expressed as a c
×
n-order fuzzy classification matrix U:
(3)
U
=
[
u
11
u
12
⋯
u
1
n
u
21
u
22
⋯
u
2
n
⋮
⋮
⋱
⋮
u
c
1
u
c
2
⋯
u
c
n
]
,
where u
i
k need to satisfy the following constraints:
(4)
(
1
)
u
i
k
∈
[
0,1
]
,
∀
i
,
k
;
(
2
)
∑
i
=
1
c
u
i
k
=
1
,
∀
k
;
(
3
)
0
<
∑
i
=
1
c
u
i
k
<
n
,
∀
i
.FCM is to search the optimum number of(
U
,
V
) for minimizing the J
FCM
(
U
,
V
). Due to the constraint ∑
i
=
1
c
u
i
k
=
1, it introduces a Lagrange multiplier λ to solve the minimum of the following formula:
(5)
J
(
U
,
V
)
=
∑
k
=
1
n
∑
i
=
1
c
u
i
k
m
∥
x
k
-
x
i
∥
2
2
+
λ
(
∑
i
=
1
c
u
i
k
-
1
)
,
where
(6)
u
i
k
=
1
∑
j
=
1
c
[
∥
x
k
-
v
i
∥
2
2
/
∥
x
k
-
v
j
∥
2
2
]
1
/
(
m
-
1
)
,
∀
i
,
k
,
v
i
=
∑
k
=
1
n
u
i
k
m
x
k
∑
k
=
1
n
u
i
k
m
,
∀
k
.
So the implementation of FCM algorithm is as follows:Step 1.
Selectε
>
0, set the initial clustering centers V
(
0
)
=
{
v
1
,
v
2
,
…
,
v
c
}, and set the number of iteration l
=
1.Step 2.
The elements of membership matrixU
(
l
) are calculated as
(7)
u
i
k
l
=
{
∑
j
=
1
c
[
∥
x
k
-
v
i
∥
2
(
l
)
∥
x
k
-
v
j
∥
2
(
l
)
]
2
/
(
m
-
1
)
}
-
1
,
∀
i
,
k
.
If d
k
j
(
l
)
=
∥
x
k
-
v
j
∥
2
(
l
)
=
0, then u
k
j
(
l
)
=
1, u
k
j
(
l
)
=
0, k
≠
j.Step 3.
Calculate the new cluster center setV
(
l
+
1
), whose elements are
(8)
V
(
l
+
1
)
=
∑
k
=
1
n
(
u
i
k
(
l
)
x
k
)
x
k
∑
k
=
1
n
(
u
i
k
(
l
)
x
k
)
m
,
∀
k
.Step 4.
If∥
v
(
l
+
1
)
-
v
(
l
)
∥
<
ε, then stop; otherwise l
=
l
+
1 and go to Step 2.


## 2.1. Basic Knowledge of the Fuzzy Sets

Fuzzy set theory and fuzzy logic [12] are presented by Zadeh, that is, to use precise methods, formulas, and models to measure and handle phenomena and rules which are vague, incomplete, or incorrect. Membership function is defined as the degree to which an object x belongs to a fuzzy set A, usually recorded as u
A
(
x
); the scopes of its argument are the all possible objects which belongs to the set A (that all the points of the space where the set A in) in the range of [
0
,
1
]; namely, 0
≤
u
A
(
x
)
≤
1. u
A
(
x
)
=
1 means that x completely belongs to set A, which is equivalent to the traditional set concept x
∈
A. A membership function defined in the space of X
=
{
x
} is defined as a fuzzy set A, or defined as fuzzy subset A in the domain of X
=
{
x
}. For the fuzzy set A
~ which has finite objects x
1
,
x
2
,
…
,
x
n can be expressed as
(1)
A
~
=
{
(
μ
A
(
x
i
)
,
x
i
)
∣
x
i
∈
X
}
.Fuzzy set theory has played an important role in many applications, such as fuzzy clustering analysis, fuzzy pattern recognition [13], fuzzy synthetic judgments [14], fuzzy decision and forecast [15, 16], fuzzy programming, fuzzy probability [17], and fuzzy statistics [18]. In the problem of clustering, the clusters generated by clustering can be regarded as fuzzy sets; therefore, the value of membership of each sample point belongs to a cluster that is in the interval [
0
,
1
].


## 2.2. Theory of FCM Algorithm

Fuzzy C-mean clustering (FCM) [19, 20] is a clustering algorithm that uses membership to determine the degree of each data point which belongs to a cluster. In 1973, Bezdek proposed the algorithm that is an improved algorithm of the early hard C-means clustering (HCM). The fuzzy clustering algorithm uses the initialization method to determine several initial clustering centers and then performs a repeated iteration which continuously adjusts and optimizes the clustering centers to achieve the minimal variance within clusters. It is a method based on the principle of least squares using iterative methods to optimize objective function to get the fuzzy partition of the data sets. Its objective function is defined as
(2)
min
J
FCM
(
U
,
V
)
=
∑
k
=
1
n
∑
i
=
1
c
u
i
k
m
d
i
k
2
,
where X
=
{
x
1
,
x
2
,
…
,
x
n
}
∈
R
n
×
p is a data set that composed of n samples of dimension p, which is divided it into C classes. x
k is a p-dimensional vector; m
∈
[
1
,
∞
) is the weighted index; when m
=
1, the fuzzy C-means clustering is degraded as the classical C-means clustering. Nikhil et al. studies show that the best choice for m is in range of [
1.5
,
2.5
] and its ideal value is usually set to m
=
2; d
i
k is generally defined as the Euclidean distance, it means the distance between sample x
k and center v
i, that is, d
i
k
=
∥
x
k
-
v
i
∥
A, ∥
·
∥
A  defines as norm of A, usually A
=
2; that is, d
i
k is 2-norm; V
=
{
v
1
,
v
2
,
…
,
v
c
}
∈
R
c
×
p is the set of c cluster centers. v
i is p-dimensional vector and denotes the i
th cluster center; u
i
k is the membership of the k
th pixel that belongs to i
th class. Therefore, the classification results can be expressed as a c
×
n-order fuzzy classification matrix U:
(3)
U
=
[
u
11
u
12
⋯
u
1
n
u
21
u
22
⋯
u
2
n
⋮
⋮
⋱
⋮
u
c
1
u
c
2
⋯
u
c
n
]
,
where u
i
k need to satisfy the following constraints:
(4)
(
1
)
u
i
k
∈
[
0,1
]
,
∀
i
,
k
;
(
2
)
∑
i
=
1
c
u
i
k
=
1
,
∀
k
;
(
3
)
0
<
∑
i
=
1
c
u
i
k
<
n
,
∀
i
.FCM is to search the optimum number of(
U
,
V
) for minimizing the J
FCM
(
U
,
V
). Due to the constraint ∑
i
=
1
c
u
i
k
=
1, it introduces a Lagrange multiplier λ to solve the minimum of the following formula:
(5)
J
(
U
,
V
)
=
∑
k
=
1
n
∑
i
=
1
c
u
i
k
m
∥
x
k
-
x
i
∥
2
2
+
λ
(
∑
i
=
1
c
u
i
k
-
1
)
,
where
(6)
u
i
k
=
1
∑
j
=
1
c
[
∥
x
k
-
v
i
∥
2
2
/
∥
x
k
-
v
j
∥
2
2
]
1
/
(
m
-
1
)
,
∀
i
,
k
,
v
i
=
∑
k
=
1
n
u
i
k
m
x
k
∑
k
=
1
n
u
i
k
m
,
∀
k
.
So the implementation of FCM algorithm is as follows:Step 1.
Selectε
>
0, set the initial clustering centers V
(
0
)
=
{
v
1
,
v
2
,
…
,
v
c
}, and set the number of iteration l
=
1.Step 2.
The elements of membership matrixU
(
l
) are calculated as
(7)
u
i
k
l
=
{
∑
j
=
1
c
[
∥
x
k
-
v
i
∥
2
(
l
)
∥
x
k
-
v
j
∥
2
(
l
)
]
2
/
(
m
-
1
)
}
-
1
,
∀
i
,
k
.
If d
k
j
(
l
)
=
∥
x
k
-
v
j
∥
2
(
l
)
=
0, then u
k
j
(
l
)
=
1, u
k
j
(
l
)
=
0, k
≠
j.Step 3.
Calculate the new cluster center setV
(
l
+
1
), whose elements are
(8)
V
(
l
+
1
)
=
∑
k
=
1
n
(
u
i
k
(
l
)
x
k
)
x
k
∑
k
=
1
n
(
u
i
k
(
l
)
x
k
)
m
,
∀
k
.Step 4.
If∥
v
(
l
+
1
)
-
v
(
l
)
∥
<
ε, then stop; otherwise l
=
l
+
1 and go to Step 2.


## 3. The TV Model

### 3.1. Model Establishment

To establish a normal formula of variation image inpainting model(9)
J
r
(
u
)
=
∫
Ω
r
|
∇
u
|
d
x
d
y
+
λ
D
2
∫
Ω
|
u
-
u
0
|
2
d
x
d
y
,
where
(10)
λ
D
=
λ
·
l
D
(
x
)
=
{
0
,
x
∈
D
λ
,
x
∈
Ω
∖
D
,
u
(
x
,
y
) is the image gray function, shorthand for u, u
0 is the defect image grayscale function, D is the repaired area, Ω is the entire image area, Ω
∖
D is the known image field, and λ is the Lagrange operator, the equation d
δ
=
d
x
d
y is a double integral.In (9), we have set the energy functional of TV model r
[
|
∇
u
|
]
=
|
∇
u
|; that is,
(11)
J
r
(
u
)
=
∫
Ω
|
∇
u
|
d
x
d
y
+
λ
D
2
∫
Ω
|
u
-
u
0
|
2
d
x
d
y
.After calculating out the extreme value of formula (11), we can obtain Euler-Lagrange equation of TV model as follows:
(12)
-
∇
·
[
∇
u
|
∇
u
|
]
-
λ
(
u
-
u
0
)
=
0
.


### 3.2. Discretization of the Model

Application of the half-point difference method to calculate the diffusion format of the partial differential equation (12).As shown in Figure1, O is the inpainting pixel point, and Λ
0
=
{
N
,
S
,
W
,
E
} means four neighborhood points set of O, and Λ
=
{
n
,
s
,
w
,
e
} means the four half-pixel points. Denote the objective pixel O by u
(
i
,
j
), Λ
0
=
{
(
i
,
j
+
1
)
,
(
i
,
j
-
1
)
,
(
i
-
1
,
j
)
,
(
i
+
1
,
j
)
}. In order to avoid |
∇
u
| turning to 0 and take the value of |
∇
u
|
ε
=
ε
2
+
|
∇
u
|
2 or |
∇
u
|
ε
=
ε
+
|
∇
u
|, if ε is small enough, it will not affect the performance of TV inpainting model.Figure 1
Inpainting pixel points and neighbor fields.Letv
=
(
v
1
,
v
2
)
=
∇
u
/
|
∇
u
| and take performance about central difference numerical method for divergence,
(13)
∇
·
v
=
∂
v
1
∂
x
+
∂
v
2
∂
y
≈
v
e
1
-
v
w
1
h
+
v
n
2
-
v
s
2
h
.The lengthh
=
1 and then solve the approach values of v
e
1, v
w
1, v
n
2, and v
s
2:
(14)
v
e
1
=
1
|
∇
u
e
|
ε
[
∂
u
∂
x
]
e
≈
1
|
∇
u
e
|
ε
u
E
-
u
O
h
,
|
∇
u
e
|
ε
≈
1
h
ε
2
+
(
u
E
-
u
O
)
2
+
(
u
N
E
-
u
S
E
+
u
N
-
u
S
4
)
2
.Similarly we can get(15)
v
w
1
=
1
|
∇
u
w
|
ε
[
∂
u
∂
x
]
w
≈
1
|
∇
u
w
|
ε
u
W
-
u
O
h
,
v
n
2
=
1
|
∇
u
n
|
ε
[
∂
u
∂
y
]
n
≈
1
|
∇
u
n
|
ε
u
N
-
u
O
h
,
v
s
2
=
1
|
∇
u
s
|
ε
[
∂
u
∂
y
]
s
≈
1
|
∇
u
s
|
ε
u
S
-
u
O
h
.So(16)
-
∇
·
[
∇
u
|
∇
u
|
]
=
-
∇
·
v
=
(
v
w
1
-
v
e
1
)
+
(
v
s
2
-
v
n
2
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
1
|
∇
u
Q
|
ε
[
u
Q
-
u
(
i
,
j
)
]
,
where Q
∈
Λ
O, q
∈
Λ means that when Q is a pixel of Λ
O, then q is the corresponding half pixel of Λ; as Q take E, correspondingly q take e. So formula (12) can be remarked as
(17)
∑
Q
∈
Λ
O
,
q
∈
Λ
1
|
∇
u
Q
|
ε
[
u
Q
-
u
(
i
,
j
)
]
+
λ
D
(
i
,
j
)
(
u
0
(
i
,
j
)
-
u
(
i
,
j
)
)
=
0
.
So,
(18)
u
(
i
,
j
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
(
1
/
|
∇
u
Q
|
ε
)
∑
Q
∈
Λ
O
,
q
∈
Λ
(
1
/
|
∇
u
Q
|
ε
)
+
λ
D
(
i
,
j
)
u
Q
+
λ
D
(
i
,
j
)
∑
Q
∈
Λ
O
,
q
∈
Λ
(
1
/
|
∇
u
Q
|
ε
)
+
λ
D
(
i
,
j
)
u
0
(
i
,
j
)
,
where
(19)
ω
q
=
1
|
∇
u
Q
|
ε
,
h
Q
=
ω
q
λ
D
(
O
)
+
∑
Q
∈
Λ
O
,
q
∈
Λ
ω
q
,
h
O
=
λ
D
(
O
)
λ
D
(
O
)
+
∑
Q
∈
Λ
O
,
q
∈
Λ
ω
q
.
So formula (18) can be remarked as:
(20)
u
(
i
,
j
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
h
Q
u
Q
+
h
O
u
O
(
i
,
j
)
,
where ∑
Q
∈
Λ
O
,
q
∈
Λ
h
Q
+
h
O
=
1; apparently, the inpainting objective pixel value u
(
i
,
j
) adds the weight h
Q to be repaired through neighbor field point u
Q.Use Gauss-Jacobi iteration method to search the optimum:(21)
u
(
n
)
(
i
,
j
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
h
Q
(
n
-
1
)
u
Q
(
n
-
1
)
+
h
O
(
n
-
1
)
u
O
(
i
,
j
)
,
where n is the number of iterations. According to the discretization process of TV model, the process of TV inpainting model mainly is shown in Algorithm 1.Algorithm 1:
Initializedu
0
(
i
,
j
), generally we set u
0
(
i
,
j
)
=
u
0
(
i
,
j
);
For  n
=
1
,
2
,
…
For  i
=
1
,
2
,
…
,
M
For  j
=
1
,
2
,
…
,
N
By the use of formula (19), calculate ω
P
,
h
P
,
h
O respectively,
the(
i
,
j
) as the center of them, then use formula (21) to calculate.
u
(
n
)
(
i
,
j
)
=
∑
Q
∈
Λ
Q
,
q
∈
Λ
h
Q
(
n
-
1
)
u
Q
(
n
-
1
)
+
h
O
(
n
-
1
)
u
0
(
i
,
j
)
End
End
End


## 3.1. Model Establishment

To establish a normal formula of variation image inpainting model(9)
J
r
(
u
)
=
∫
Ω
r
|
∇
u
|
d
x
d
y
+
λ
D
2
∫
Ω
|
u
-
u
0
|
2
d
x
d
y
,
where
(10)
λ
D
=
λ
·
l
D
(
x
)
=
{
0
,
x
∈
D
λ
,
x
∈
Ω
∖
D
,
u
(
x
,
y
) is the image gray function, shorthand for u, u
0 is the defect image grayscale function, D is the repaired area, Ω is the entire image area, Ω
∖
D is the known image field, and λ is the Lagrange operator, the equation d
δ
=
d
x
d
y is a double integral.In (9), we have set the energy functional of TV model r
[
|
∇
u
|
]
=
|
∇
u
|; that is,
(11)
J
r
(
u
)
=
∫
Ω
|
∇
u
|
d
x
d
y
+
λ
D
2
∫
Ω
|
u
-
u
0
|
2
d
x
d
y
.After calculating out the extreme value of formula (11), we can obtain Euler-Lagrange equation of TV model as follows:
(12)
-
∇
·
[
∇
u
|
∇
u
|
]
-
λ
(
u
-
u
0
)
=
0
.


## 3.2. Discretization of the Model

Application of the half-point difference method to calculate the diffusion format of the partial differential equation (12).As shown in Figure1, O is the inpainting pixel point, and Λ
0
=
{
N
,
S
,
W
,
E
} means four neighborhood points set of O, and Λ
=
{
n
,
s
,
w
,
e
} means the four half-pixel points. Denote the objective pixel O by u
(
i
,
j
), Λ
0
=
{
(
i
,
j
+
1
)
,
(
i
,
j
-
1
)
,
(
i
-
1
,
j
)
,
(
i
+
1
,
j
)
}. In order to avoid |
∇
u
| turning to 0 and take the value of |
∇
u
|
ε
=
ε
2
+
|
∇
u
|
2 or |
∇
u
|
ε
=
ε
+
|
∇
u
|, if ε is small enough, it will not affect the performance of TV inpainting model.Figure 1
Inpainting pixel points and neighbor fields.Letv
=
(
v
1
,
v
2
)
=
∇
u
/
|
∇
u
| and take performance about central difference numerical method for divergence,
(13)
∇
·
v
=
∂
v
1
∂
x
+
∂
v
2
∂
y
≈
v
e
1
-
v
w
1
h
+
v
n
2
-
v
s
2
h
.The lengthh
=
1 and then solve the approach values of v
e
1, v
w
1, v
n
2, and v
s
2:
(14)
v
e
1
=
1
|
∇
u
e
|
ε
[
∂
u
∂
x
]
e
≈
1
|
∇
u
e
|
ε
u
E
-
u
O
h
,
|
∇
u
e
|
ε
≈
1
h
ε
2
+
(
u
E
-
u
O
)
2
+
(
u
N
E
-
u
S
E
+
u
N
-
u
S
4
)
2
.Similarly we can get(15)
v
w
1
=
1
|
∇
u
w
|
ε
[
∂
u
∂
x
]
w
≈
1
|
∇
u
w
|
ε
u
W
-
u
O
h
,
v
n
2
=
1
|
∇
u
n
|
ε
[
∂
u
∂
y
]
n
≈
1
|
∇
u
n
|
ε
u
N
-
u
O
h
,
v
s
2
=
1
|
∇
u
s
|
ε
[
∂
u
∂
y
]
s
≈
1
|
∇
u
s
|
ε
u
S
-
u
O
h
.So(16)
-
∇
·
[
∇
u
|
∇
u
|
]
=
-
∇
·
v
=
(
v
w
1
-
v
e
1
)
+
(
v
s
2
-
v
n
2
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
1
|
∇
u
Q
|
ε
[
u
Q
-
u
(
i
,
j
)
]
,
where Q
∈
Λ
O, q
∈
Λ means that when Q is a pixel of Λ
O, then q is the corresponding half pixel of Λ; as Q take E, correspondingly q take e. So formula (12) can be remarked as
(17)
∑
Q
∈
Λ
O
,
q
∈
Λ
1
|
∇
u
Q
|
ε
[
u
Q
-
u
(
i
,
j
)
]
+
λ
D
(
i
,
j
)
(
u
0
(
i
,
j
)
-
u
(
i
,
j
)
)
=
0
.
So,
(18)
u
(
i
,
j
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
(
1
/
|
∇
u
Q
|
ε
)
∑
Q
∈
Λ
O
,
q
∈
Λ
(
1
/
|
∇
u
Q
|
ε
)
+
λ
D
(
i
,
j
)
u
Q
+
λ
D
(
i
,
j
)
∑
Q
∈
Λ
O
,
q
∈
Λ
(
1
/
|
∇
u
Q
|
ε
)
+
λ
D
(
i
,
j
)
u
0
(
i
,
j
)
,
where
(19)
ω
q
=
1
|
∇
u
Q
|
ε
,
h
Q
=
ω
q
λ
D
(
O
)
+
∑
Q
∈
Λ
O
,
q
∈
Λ
ω
q
,
h
O
=
λ
D
(
O
)
λ
D
(
O
)
+
∑
Q
∈
Λ
O
,
q
∈
Λ
ω
q
.
So formula (18) can be remarked as:
(20)
u
(
i
,
j
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
h
Q
u
Q
+
h
O
u
O
(
i
,
j
)
,
where ∑
Q
∈
Λ
O
,
q
∈
Λ
h
Q
+
h
O
=
1; apparently, the inpainting objective pixel value u
(
i
,
j
) adds the weight h
Q to be repaired through neighbor field point u
Q.Use Gauss-Jacobi iteration method to search the optimum:(21)
u
(
n
)
(
i
,
j
)
=
∑
Q
∈
Λ
O
,
q
∈
Λ
h
Q
(
n
-
1
)
u
Q
(
n
-
1
)
+
h
O
(
n
-
1
)
u
O
(
i
,
j
)
,
where n is the number of iterations. According to the discretization process of TV model, the process of TV inpainting model mainly is shown in Algorithm 1.Algorithm 1:
Initializedu
0
(
i
,
j
), generally we set u
0
(
i
,
j
)
=
u
0
(
i
,
j
);
For  n
=
1
,
2
,
…
For  i
=
1
,
2
,
…
,
M
For  j
=
1
,
2
,
…
,
N
By the use of formula (19), calculate ω
P
,
h
P
,
h
O respectively,
the(
i
,
j
) as the center of them, then use formula (21) to calculate.
u
(
n
)
(
i
,
j
)
=
∑
Q
∈
Λ
Q
,
q
∈
Λ
h
Q
(
n
-
1
)
u
Q
(
n
-
1
)
+
h
O
(
n
-
1
)
u
0
(
i
,
j
)
End
End
End


## 4. Computer Experiment

### 4.1. FCM Experimental Analysis

In the FCM experiment in this paper given gray values of the pixel which in the repaired areas, we can calculate the Euclidean distance of it with each clustering center concluded by formula (8), the cluster which has the minimum distance is the repaired area D.In this experiment, it is crucial to select the appropriate values of these parameters, namely, the number of image clustering (C value), the initial value of the clustering center (V), C, and the clustering center initial value selected which directly influence whether the defect area can be accurately identified. Generally apply the gray value distribution of the gray histogram of the image to be repaired to determine the value of C and V.We discussed the experimental results of FCM to identify scratches, text, and big block inpainting areas


#### 4.1.1. Scratch Inpainting

In Figure2(a) there is identification effect of areas to be repaired; Figure 2(b) is gray histogram of Figure 2(a).(a) Identification effect of areas to be repaired withC = 6. (b) The gray histogram of image to be repaired. (c) Identification effect of areas to be repaired with C = 8.
(a)
(b)
(c)As Table1 has shown in the experiment, we set C = 6; to initialize clustering centers V
=
[
0
,
50
,
100
,
125
,
175
,
255
] and update the clustering centers, obtained clustering center 1 is 21.6442, and the clustering center 2 is 69.3399, the clustering center 3 is 108.8676, the clustering center 4 is 154.7014, the clustering center 5 is 192.2138, and the clustering center 6 is 217.2253. Apparently the area to be repaired in cluster 1 identifying the scratches of the repaired area was shown in Figure 2(a), the pixel in the image to be repaired where it close to black gray value will impact identification of the repaired areas from the figure.Table 1
Clustering centers table.
Initial and obtained cluster centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
21.6442
Clustering center 2
50
69.3399
Clustering center 3
100
108.8676
Clustering center 4
125
154.7014
Clustering center 5
175
192.2138
Clustering center 6
255
217.2253When setC = 8, identification effect of areas to be repaired was shown in Figure 2(c).Apparently, the effect of Figure2(c) is better than that of Figure 2(a); at this time, we initialize the clustering center V
=
[
0
,
20
,
50
,
75
,
100
,
125
,
175
,
255
] and the clustering center 1 is 9.6953, the clustering center 2 is 45.918, the clustering center 3 is 78.5321, the clustering center 4 is 107.6517, the clustering center 5 is 139.0719, the clustering center 6 is 169.5539, the clustering center 7 is 196.3286, the clustering center 8 is 218.8029. Area to be repaired which has been in Cluster 1, as shown in Tables 1 and 2, the cluster center value of 1 is closer to the color of the area to be repaired (gray value is 0) than the cluster center value of 1 when C = 6. Therefore, for the greater value of C, the identification is more accurate.Table 2
Clustering centers table.
Initial and obtained clustering center
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
9.6953
Clustering center 2
20
45.918
Clustering center 3
50
78.5321
Clustering center 4
75
107.6517
Clustering center 5
100
139.0719
Clustering center 6
125
169.5539
Clustering center 7
175
196.3286
Clustering center 8
255
218.8029


#### 4.1.2. Text Inpainting

In Figure3(a), there is the identification result of the areas to be repaired; Figure 3(b) is gray histogram of Figure 3(a).(a) Identification effect of areas to be repaired withC = 5. (b) The gray histogram of image to be repaired.
(a)
(b)As Table3 shows, in the experiment, we set C = 5 initialize clustering center V
=
[
0,75,150,200,255
], obtained the clustering center 1 is 52.0827, the clustering center 2 is 85.3504, the clustering center 3 is 119.696, the clustering center 4 is 171.9693, and the clustering center 5 is 254.6589. Apparently, the area to be repaired in cluster 5 identifying the scratches of the repaired area was shown in Figure 3(a).Table 3
Clustering centers table.
Initial and obtained clustering center
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
52.0827
Clustering center 2
75
85.3504
Clustering center 3
150
119.696
Clustering center 4
200
171.9693
Clustering center 5
255
254.6589


#### 4.1.3. The Big Block Area Inpainting

In Figure4(a), there is the identification result of areas to be repaired; Figure 4(b) presents gray histogram of Figure 4(a).(a) Identification effect of areas to be repaired withC = 7. (b) The gray histogram of image to be repaired. (c) Identification effect of areas to be repaired with C = 10.
(a)
(b)
(c)As Table4 has shown, in the experiment, we set C = 7, to initialize clustering center V
=
[
10,20,50,100,125,175,255
], update the clustering center, finally obtained the clustering center 1 is 22.732, the clustering center 2 is 60.23, the clustering center 3 is 93.2463, the clustering center 4 is 124.5873, the clustering center 5 is 162.8123, the clustering center 6 is 194.4558, and the clustering center 7 is 217.9387. Apparently, area to be repaired in cluster 1 identifying the scratches of the repaired area was shown in Figure 4(a); the pixels in the image to be repaired nearly black will be misclassified as noise, so if the grayscale values of the area to be repaired are similar to the gray values ​
​of the known area, they will be misclassified.Table 4
Clustering centers table.
Initial and obtained clustering centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
10
22.732
Clustering center 2
20
60.23
Clustering center 3
50
93.2463
Clustering center 4
100
124.5873
Clustering center 5
125
162.8123
Clustering center 6
175
194.4558
Clustering center 7
255
217.9387When we setC = 10, the extracted area to be repaired was shown in Figure 4(c).Apparently, the result of Figure4(c) is better than Figure 4(a); at this time, to initialize clustering center V
=
[
0,10,20,30,40,50,100,125,175,255
], update the clustering center, finally obtained the clustering center 1 is 12.2282, the clustering center 2 is 39.6536, the clustering center 3 is 63.6337, the clustering center 4 is 85.1273, the clustering center 5 is 106.6592, the clustering center 6 is 129.8529, the clustering center 7 is 156.3771, the clustering center 8 is 179.4131, the clustering center 9 is 198.9847, and the clustering center 10 is 219.6205. At this time, Area to be repaired which has been in Cluster 1, as shown in Tables 4 and 5, the cluster center value of 1 is closer to the color of the area to be repaired (gray value is 0) than the cluster center value of 1 when C = 7. Therefore, the greater value of C and the initial value of clustering center are more appropriate, and the more accurate identification results can be obtained.Table 5
Cluster center table.
Initial and obtained clustering centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
12.2282
Clustering center 2
10
39.6536
Clustering center 3
20
63.6337
Clustering center 4
30
85.1273
Clustering center 5
40
106.6592
Clustering center 6
50
129.8529
Clustering center 7
100
156.3771
Clustering center 8
125
179.4131
Clustering center 9
175
198.9847
Clustering center 10
255
219.6205


### 4.2. Realization of the Image Automatic Inpainting

Letλ
=
0, ε
=
0.0001 with improved signal-to-noise (ISNR) as the objective metric standard of the quantity of the inpainting image, the definition of ISNR as
(22)
ISNR
=
10
·
log
10
{
∑
x
=
1
M
∑
y
=
1
N
[
I
^
(
x
,
y
)
-
I
0
(
x
,
y
)
]
2
∑
x
=
1
∑
y
=
1
[
I
^
(
x
,
y
)
-
I
0
(
x
,
y
)
]
2
}
,
where I
^
(
x
,
y
) is the original gray image, I
0
(
x
,
y
) is the damaged image, and I
(
x
,
y
) is the recovered image.Combining TV model inpainting algorithm with FCM identifying the damaged areas, we have discussed the automatic inpainting effect of scratches and big block damaged areas as follows.


#### 4.2.1. Scratch Inpainting

In the following experiments,n is the number of iteration, T is the inpainting time, and ISNR is improved signal-to-noise.Figures5(a) and 5(b) show that the automatic inpainting model has good inpainting effect on fine scratches and coarse scratches and can accurately identify the different kinds of image noise. Figure 5(a) is black noise, and Figure 5(b) is white noise.(a)n
=
50, T
=
0.0832, ISNR = 60.648. (b) n
=
50, T
=
0.0685, ISNR = 53.0085.
(a)
(b)


#### 4.2.2. The Big Block Area Inpainting

Comparing Figures5 and 6, it shows that the automatic image inpainting model may generate blurred edges for big block damaged area, not as good as small inpainting areas.(a)n
=
50, T
=
0.0598, ISNR = 35.5889. (b) n
=
50, T
=
0.1054, ISNR = 10.0905.
(a)
(b)


## 4.1. FCM Experimental Analysis

In the FCM experiment in this paper given gray values of the pixel which in the repaired areas, we can calculate the Euclidean distance of it with each clustering center concluded by formula (8), the cluster which has the minimum distance is the repaired area D.In this experiment, it is crucial to select the appropriate values of these parameters, namely, the number of image clustering (C value), the initial value of the clustering center (V), C, and the clustering center initial value selected which directly influence whether the defect area can be accurately identified. Generally apply the gray value distribution of the gray histogram of the image to be repaired to determine the value of C and V.We discussed the experimental results of FCM to identify scratches, text, and big block inpainting areas


### 4.1.1. Scratch Inpainting

In Figure2(a) there is identification effect of areas to be repaired; Figure 2(b) is gray histogram of Figure 2(a).(a) Identification effect of areas to be repaired withC = 6. (b) The gray histogram of image to be repaired. (c) Identification effect of areas to be repaired with C = 8.
(a)
(b)
(c)As Table1 has shown in the experiment, we set C = 6; to initialize clustering centers V
=
[
0
,
50
,
100
,
125
,
175
,
255
] and update the clustering centers, obtained clustering center 1 is 21.6442, and the clustering center 2 is 69.3399, the clustering center 3 is 108.8676, the clustering center 4 is 154.7014, the clustering center 5 is 192.2138, and the clustering center 6 is 217.2253. Apparently the area to be repaired in cluster 1 identifying the scratches of the repaired area was shown in Figure 2(a), the pixel in the image to be repaired where it close to black gray value will impact identification of the repaired areas from the figure.Table 1
Clustering centers table.
Initial and obtained cluster centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
21.6442
Clustering center 2
50
69.3399
Clustering center 3
100
108.8676
Clustering center 4
125
154.7014
Clustering center 5
175
192.2138
Clustering center 6
255
217.2253When setC = 8, identification effect of areas to be repaired was shown in Figure 2(c).Apparently, the effect of Figure2(c) is better than that of Figure 2(a); at this time, we initialize the clustering center V
=
[
0
,
20
,
50
,
75
,
100
,
125
,
175
,
255
] and the clustering center 1 is 9.6953, the clustering center 2 is 45.918, the clustering center 3 is 78.5321, the clustering center 4 is 107.6517, the clustering center 5 is 139.0719, the clustering center 6 is 169.5539, the clustering center 7 is 196.3286, the clustering center 8 is 218.8029. Area to be repaired which has been in Cluster 1, as shown in Tables 1 and 2, the cluster center value of 1 is closer to the color of the area to be repaired (gray value is 0) than the cluster center value of 1 when C = 6. Therefore, for the greater value of C, the identification is more accurate.Table 2
Clustering centers table.
Initial and obtained clustering center
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
9.6953
Clustering center 2
20
45.918
Clustering center 3
50
78.5321
Clustering center 4
75
107.6517
Clustering center 5
100
139.0719
Clustering center 6
125
169.5539
Clustering center 7
175
196.3286
Clustering center 8
255
218.8029


### 4.1.2. Text Inpainting

In Figure3(a), there is the identification result of the areas to be repaired; Figure 3(b) is gray histogram of Figure 3(a).(a) Identification effect of areas to be repaired withC = 5. (b) The gray histogram of image to be repaired.
(a)
(b)As Table3 shows, in the experiment, we set C = 5 initialize clustering center V
=
[
0,75,150,200,255
], obtained the clustering center 1 is 52.0827, the clustering center 2 is 85.3504, the clustering center 3 is 119.696, the clustering center 4 is 171.9693, and the clustering center 5 is 254.6589. Apparently, the area to be repaired in cluster 5 identifying the scratches of the repaired area was shown in Figure 3(a).Table 3
Clustering centers table.
Initial and obtained clustering center
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
52.0827
Clustering center 2
75
85.3504
Clustering center 3
150
119.696
Clustering center 4
200
171.9693
Clustering center 5
255
254.6589


### 4.1.3. The Big Block Area Inpainting

In Figure4(a), there is the identification result of areas to be repaired; Figure 4(b) presents gray histogram of Figure 4(a).(a) Identification effect of areas to be repaired withC = 7. (b) The gray histogram of image to be repaired. (c) Identification effect of areas to be repaired with C = 10.
(a)
(b)
(c)As Table4 has shown, in the experiment, we set C = 7, to initialize clustering center V
=
[
10,20,50,100,125,175,255
], update the clustering center, finally obtained the clustering center 1 is 22.732, the clustering center 2 is 60.23, the clustering center 3 is 93.2463, the clustering center 4 is 124.5873, the clustering center 5 is 162.8123, the clustering center 6 is 194.4558, and the clustering center 7 is 217.9387. Apparently, area to be repaired in cluster 1 identifying the scratches of the repaired area was shown in Figure 4(a); the pixels in the image to be repaired nearly black will be misclassified as noise, so if the grayscale values of the area to be repaired are similar to the gray values ​
​of the known area, they will be misclassified.Table 4
Clustering centers table.
Initial and obtained clustering centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
10
22.732
Clustering center 2
20
60.23
Clustering center 3
50
93.2463
Clustering center 4
100
124.5873
Clustering center 5
125
162.8123
Clustering center 6
175
194.4558
Clustering center 7
255
217.9387When we setC = 10, the extracted area to be repaired was shown in Figure 4(c).Apparently, the result of Figure4(c) is better than Figure 4(a); at this time, to initialize clustering center V
=
[
0,10,20,30,40,50,100,125,175,255
], update the clustering center, finally obtained the clustering center 1 is 12.2282, the clustering center 2 is 39.6536, the clustering center 3 is 63.6337, the clustering center 4 is 85.1273, the clustering center 5 is 106.6592, the clustering center 6 is 129.8529, the clustering center 7 is 156.3771, the clustering center 8 is 179.4131, the clustering center 9 is 198.9847, and the clustering center 10 is 219.6205. At this time, Area to be repaired which has been in Cluster 1, as shown in Tables 4 and 5, the cluster center value of 1 is closer to the color of the area to be repaired (gray value is 0) than the cluster center value of 1 when C = 7. Therefore, the greater value of C and the initial value of clustering center are more appropriate, and the more accurate identification results can be obtained.Table 5
Cluster center table.
Initial and obtained clustering centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
12.2282
Clustering center 2
10
39.6536
Clustering center 3
20
63.6337
Clustering center 4
30
85.1273
Clustering center 5
40
106.6592
Clustering center 6
50
129.8529
Clustering center 7
100
156.3771
Clustering center 8
125
179.4131
Clustering center 9
175
198.9847
Clustering center 10
255
219.6205


## 4.1.1. Scratch Inpainting

In Figure2(a) there is identification effect of areas to be repaired; Figure 2(b) is gray histogram of Figure 2(a).(a) Identification effect of areas to be repaired withC = 6. (b) The gray histogram of image to be repaired. (c) Identification effect of areas to be repaired with C = 8.
(a)
(b)
(c)As Table1 has shown in the experiment, we set C = 6; to initialize clustering centers V
=
[
0
,
50
,
100
,
125
,
175
,
255
] and update the clustering centers, obtained clustering center 1 is 21.6442, and the clustering center 2 is 69.3399, the clustering center 3 is 108.8676, the clustering center 4 is 154.7014, the clustering center 5 is 192.2138, and the clustering center 6 is 217.2253. Apparently the area to be repaired in cluster 1 identifying the scratches of the repaired area was shown in Figure 2(a), the pixel in the image to be repaired where it close to black gray value will impact identification of the repaired areas from the figure.Table 1
Clustering centers table.
Initial and obtained cluster centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
21.6442
Clustering center 2
50
69.3399
Clustering center 3
100
108.8676
Clustering center 4
125
154.7014
Clustering center 5
175
192.2138
Clustering center 6
255
217.2253When setC = 8, identification effect of areas to be repaired was shown in Figure 2(c).Apparently, the effect of Figure2(c) is better than that of Figure 2(a); at this time, we initialize the clustering center V
=
[
0
,
20
,
50
,
75
,
100
,
125
,
175
,
255
] and the clustering center 1 is 9.6953, the clustering center 2 is 45.918, the clustering center 3 is 78.5321, the clustering center 4 is 107.6517, the clustering center 5 is 139.0719, the clustering center 6 is 169.5539, the clustering center 7 is 196.3286, the clustering center 8 is 218.8029. Area to be repaired which has been in Cluster 1, as shown in Tables 1 and 2, the cluster center value of 1 is closer to the color of the area to be repaired (gray value is 0) than the cluster center value of 1 when C = 6. Therefore, for the greater value of C, the identification is more accurate.Table 2
Clustering centers table.
Initial and obtained clustering center
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
9.6953
Clustering center 2
20
45.918
Clustering center 3
50
78.5321
Clustering center 4
75
107.6517
Clustering center 5
100
139.0719
Clustering center 6
125
169.5539
Clustering center 7
175
196.3286
Clustering center 8
255
218.8029


## 4.1.2. Text Inpainting

In Figure3(a), there is the identification result of the areas to be repaired; Figure 3(b) is gray histogram of Figure 3(a).(a) Identification effect of areas to be repaired withC = 5. (b) The gray histogram of image to be repaired.
(a)
(b)As Table3 shows, in the experiment, we set C = 5 initialize clustering center V
=
[
0,75,150,200,255
], obtained the clustering center 1 is 52.0827, the clustering center 2 is 85.3504, the clustering center 3 is 119.696, the clustering center 4 is 171.9693, and the clustering center 5 is 254.6589. Apparently, the area to be repaired in cluster 5 identifying the scratches of the repaired area was shown in Figure 3(a).Table 3
Clustering centers table.
Initial and obtained clustering center
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
52.0827
Clustering center 2
75
85.3504
Clustering center 3
150
119.696
Clustering center 4
200
171.9693
Clustering center 5
255
254.6589


## 4.1.3. The Big Block Area Inpainting

In Figure4(a), there is the identification result of areas to be repaired; Figure 4(b) presents gray histogram of Figure 4(a).(a) Identification effect of areas to be repaired withC = 7. (b) The gray histogram of image to be repaired. (c) Identification effect of areas to be repaired with C = 10.
(a)
(b)
(c)As Table4 has shown, in the experiment, we set C = 7, to initialize clustering center V
=
[
10,20,50,100,125,175,255
], update the clustering center, finally obtained the clustering center 1 is 22.732, the clustering center 2 is 60.23, the clustering center 3 is 93.2463, the clustering center 4 is 124.5873, the clustering center 5 is 162.8123, the clustering center 6 is 194.4558, and the clustering center 7 is 217.9387. Apparently, area to be repaired in cluster 1 identifying the scratches of the repaired area was shown in Figure 4(a); the pixels in the image to be repaired nearly black will be misclassified as noise, so if the grayscale values of the area to be repaired are similar to the gray values ​
​of the known area, they will be misclassified.Table 4
Clustering centers table.
Initial and obtained clustering centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
10
22.732
Clustering center 2
20
60.23
Clustering center 3
50
93.2463
Clustering center 4
100
124.5873
Clustering center 5
125
162.8123
Clustering center 6
175
194.4558
Clustering center 7
255
217.9387When we setC = 10, the extracted area to be repaired was shown in Figure 4(c).Apparently, the result of Figure4(c) is better than Figure 4(a); at this time, to initialize clustering center V
=
[
0,10,20,30,40,50,100,125,175,255
], update the clustering center, finally obtained the clustering center 1 is 12.2282, the clustering center 2 is 39.6536, the clustering center 3 is 63.6337, the clustering center 4 is 85.1273, the clustering center 5 is 106.6592, the clustering center 6 is 129.8529, the clustering center 7 is 156.3771, the clustering center 8 is 179.4131, the clustering center 9 is 198.9847, and the clustering center 10 is 219.6205. At this time, Area to be repaired which has been in Cluster 1, as shown in Tables 4 and 5, the cluster center value of 1 is closer to the color of the area to be repaired (gray value is 0) than the cluster center value of 1 when C = 7. Therefore, the greater value of C and the initial value of clustering center are more appropriate, and the more accurate identification results can be obtained.Table 5
Cluster center table.
Initial and obtained clustering centers
Initial clustering centers
Obtained clustering centers
Clustering center 1
0
12.2282
Clustering center 2
10
39.6536
Clustering center 3
20
63.6337
Clustering center 4
30
85.1273
Clustering center 5
40
106.6592
Clustering center 6
50
129.8529
Clustering center 7
100
156.3771
Clustering center 8
125
179.4131
Clustering center 9
175
198.9847
Clustering center 10
255
219.6205


## 4.2. Realization of the Image Automatic Inpainting

Letλ
=
0, ε
=
0.0001 with improved signal-to-noise (ISNR) as the objective metric standard of the quantity of the inpainting image, the definition of ISNR as
(22)
ISNR
=
10
·
log
10
{
∑
x
=
1
M
∑
y
=
1
N
[
I
^
(
x
,
y
)
-
I
0
(
x
,
y
)
]
2
∑
x
=
1
∑
y
=
1
[
I
^
(
x
,
y
)
-
I
0
(
x
,
y
)
]
2
}
,
where I
^
(
x
,
y
) is the original gray image, I
0
(
x
,
y
) is the damaged image, and I
(
x
,
y
) is the recovered image.Combining TV model inpainting algorithm with FCM identifying the damaged areas, we have discussed the automatic inpainting effect of scratches and big block damaged areas as follows.


### 4.2.1. Scratch Inpainting

In the following experiments,n is the number of iteration, T is the inpainting time, and ISNR is improved signal-to-noise.Figures5(a) and 5(b) show that the automatic inpainting model has good inpainting effect on fine scratches and coarse scratches and can accurately identify the different kinds of image noise. Figure 5(a) is black noise, and Figure 5(b) is white noise.(a)n
=
50, T
=
0.0832, ISNR = 60.648. (b) n
=
50, T
=
0.0685, ISNR = 53.0085.
(a)
(b)


### 4.2.2. The Big Block Area Inpainting

Comparing Figures5 and 6, it shows that the automatic image inpainting model may generate blurred edges for big block damaged area, not as good as small inpainting areas.(a)n
=
50, T
=
0.0598, ISNR = 35.5889. (b) n
=
50, T
=
0.1054, ISNR = 10.0905.
(a)
(b)


## 4.2.1. Scratch Inpainting

In the following experiments,n is the number of iteration, T is the inpainting time, and ISNR is improved signal-to-noise.Figures5(a) and 5(b) show that the automatic inpainting model has good inpainting effect on fine scratches and coarse scratches and can accurately identify the different kinds of image noise. Figure 5(a) is black noise, and Figure 5(b) is white noise.(a)n
=
50, T
=
0.0832, ISNR = 60.648. (b) n
=
50, T
=
0.0685, ISNR = 53.0085.
(a)
(b)


## 4.2.2. The Big Block Area Inpainting

Comparing Figures5 and 6, it shows that the automatic image inpainting model may generate blurred edges for big block damaged area, not as good as small inpainting areas.(a)n
=
50, T
=
0.0598, ISNR = 35.5889. (b) n
=
50, T
=
0.1054, ISNR = 10.0905.
(a)
(b)


## 5. Conclusions

FCM clustering is an unsupervised clustering technique applied to classify images into clusters with similar properties. It utilizes the distance between pixels and cluster centers in the repaired area to compute the membership function. Experiments showed that the inpainting effect of automatic image inpainting model was decided by the inpainting model, identifying the repaired area that depends on FCM algorithm. When the selected clustering numberC and the selected clustering center initial value are appropriate, FCM can accurately identify the repaired area. As combined with the inpainting model, we can realize automatic digital image inpainting function.



---

*Source: 201704-2014-01-02.xml*