A Novel Exemplar-Based Image Inpainting Algorithm
A Novel Exemplar-Based Image Inpainting Algorithm
LIU Ying, LIU Chan-juan*, ZOU Hai-lin, ZHOU Shu-sen, SHEN Qian, CHEN Tong-tong
School of Information and Electrical Engineering
Ludong University
Yantai, China
luckycj80@sina.com
87
Authorized licensed use limited to: J.R.D. Tata Memorial Library Indian Institute of Science Bengaluru. Downloaded on July 09,2024 at 05:40:31 UTC from IEEE Xplore. Restrictions apply.
Secondly, the data term is only defined by isophote, From what has been discussed above, we define the
which can not fully describe image structure. While, the structure control function constructed by the local structure
structure tensor can effectively describe the local structure of measurement function as follows:
information, and the relationship of its eigenvalues can
represent different image partitions. Based on this, we
introduce the structure tensor into our proposed model to H ( p ) = K ⋅ h + exp( − h ) (8)
optimal the priority.
Where K is an constant, and after experimental
Structure tensor: verification we can able to recover structure characteristics
of the damaged image accurately and promote the visual
effect obviously when K = 0.8 . The introduction of
§ ∂ 2u ∂u ∂u ·
¨ 2 ⋅ ¸ H ( p ) , firstly, increases the structure factors in the repair
§j j12 · ¨ ∂ x ∂x ∂y ¸ process and ensures the spread of priority for the local
J ρ = ¨¨ 11 ¸¸ = G ρ * ¨ (5)
∂ 2u ¸
2
© j21 j22 ¹ ∂u ∂u structure. Secondly, it also leads to more accurate
¨¨ ⋅ ¸
© ∂x ∂y ∂ 2 y ¸¹ judgments to image structure for the algorithm, thus ensures
the repair effect. The improved priority is:
Where Gρ is a Gaussian function with standard
∂u ∂u P ( p ) = a1C ( p ) + a 2 D ( p ) + a 3 H ( p ) (9)
deviation ρ , u presents the image, and and are
∂x ∂y
horizontal and vertical components of the gradient vector at Where a1 , a 2 , a3 are weights, and a1 + a 2 + a3 = 1 .
each pixel respectively. Since matrix J ρ is symmetric and We can enlarge the proportion of a1 appropriately, when
positive semi-definite, it has two eigenvalues as follows: the damaged image has rich texture feature. Experimental
parameter can be set to a1 : a 2 : a3 = 3 : 1 : 1 . And when the
local structure information is more abundant, we can
1
λ1,2 = ( j11 + j22 ± ( j11 + j22 ) 2 + 4 j122 ) (6) enlarge the proportion of a2 . Experiment parameter can be
2
set to a1 : a 2 : a3 = 1 : 3 : 1 , and similarly set to
This paper introduces the local measure function a1 : a 2 : a3 = 1 : 1 : 3 when the linear structure is rich.
defined in [12] :
B. Search for the optimal patch
h =| λ1 − λ2 | 2
(7) Criminisi algorithm searches the optimal match patch
among the global scope after finding image patch with
highest priority. No doubt, this will increase the time
Equation (9) characterizes the constant area of the complexity and reduce the repair efficiency. In view of this,
image when meet the condition h → 0 , while denotes area we reset the search way for optimal matching block. That is
of rich structure information, such as the edges and corners.
only when the known pixel values in the match patch Ψp
Our structure control function should satisfy the corresponding to the target one, meet the following
following conditions: increases with the growth of h as formula:
well as the improvement of the image structure. In order to
reduce the computation complexity as far as possible, here
we adapt the linear increment form. It indicates that the (1 − δ ) ⋅ sum( Ψ p ) ≤ sum( Ψ′q ) ≤ (1 + δ ) ⋅ sum( Ψ p ) (10)
image tends to constant area when h → 0 .To ensure the
structure control function non-vanishing and the effect to where Ψq' denotes patches with zero pixel values
describe the local structure, we plus a small value exp( −h )
corresponding to the match ones and δ ∈ [0,1] .Demonstrated
on the basis of the linear follow function. When the two
eigenvalues have little value difference, it can ensure the from experimental verification that we can not only obtain
structure change control function also non-vanishing and good visual repair effect but also reduce the time
play a role in describing the influence of structure strength. complexity effectively when we set δ = 0.2
When the difference is enhancing, however its effect is
reducing. As this result, the structure control function can C. Matching criterion
ensure the linear following performance of the structure The matching criterion that the second step of the
control function, and describe the structure changes of the Criminisi algorithm based to search the optimal matching
image accurately. patch is:
88
Authorized licensed use limited to: J.R.D. Tata Memorial Library Indian Institute of Science Bengaluru. Downloaded on July 09,2024 at 05:40:31 UTC from IEEE Xplore. Restrictions apply.
Ψq~ = arg min d ( Ψ p , Ψq ) (11) use cartoon image ( a1 ), rich structure ( b1 ), rich texture
Ψq ⊂ Φ
details ( c1 ) as the input images respectively to verify the
However, it tends to have more than one target patches validity of our algorithm. Taking peak signal-to-noise
that consistent with the ready matching one according to the ratio(PSNR),the mean absolute error(MAE) and the running
color matching rule. Then the Criminisi algorithm selects time(s) as the objective indexes to evaluate the inpainted
the target block randomly. However the randomness will images treated by CDD model based on partial differential
seriously affect the effect of inpainting if the target patch equation, Criminsi algorithm and [8] model.
selected unsuitably. Here, using the proposed structure Peak signal-to-noise ratio (PSNR) is defined as:
tensor eigenvalues aforementioned, we define a new
matching criterion:
2552
PSNR = 10 lg m n
(13)
n 1
Ψq~ = arg min d ( Ψ p , Ψq ) + ¦ [(λ1 − λ1′) 2 + (λ 2 − λ 2′ ) 2 ]
Ψq ⊂ Φ
(12) ¦¦ (uˆ − u) 2
m × n i =1 j =1
i =1
It ensures higher similarity of the target patch and the Mean absolute error (MAE) is defined as:
matching one to a large extent, thereby reduces the number
of the multiple target patch significantly and the error
matching rate accordingly.
Fig. 2 to Fig. 4 show the image visual effect of the
IV. RESULTS AND ANALYSIS tested images using four approaches separately. TABLEĉ
In order to verify the effectiveness of the algorithm to TABLE ċ show the value of PSNR, MAE and the
proposed in this paper, we perform sets of simulation running time using four different approaches .
experiments make use of MATLAB 㧔 2011b 㧕 . Now we
( a1 ) Original image ( a 2 ) Damaged image ( a 3 ) Criminsi algorithm ( b4 ) CDD model ( b5 ) Reference [8] model ( b6 ) Our algorithm
89
Authorized licensed use limited to: J.R.D. Tata Memorial Library Indian Institute of Science Bengaluru. Downloaded on July 09,2024 at 05:40:31 UTC from IEEE Xplore. Restrictions apply.
TABLE I. PSNR(DB) WITH DIFFERENT APPROACHES and search method for optimal matching patch.
Test images Experimental results prove the validity of the improved
Approaches
Image 1 Image 2 Image 3 algorithm in the quality of the restored image. But the
CDD model 14.0762 18.9257 27.1975 threshold set in the proposed algorithm can not change with
Criminisi algorithm 17.9319 25.7220 30.8456 different image structure correspondingly, and this may
Reference[8]model 30.0245 25.4812 30.9023
Our algorithm 35.2745 26.8389 30.9677 limit the applicability of it to some extent. With the
development of the GPU and cloud computing
TABLE II. MAE WITH DIFFERENT APPROACHES technologies, it makes sense to use these resources to
Test images
improve the time efficiency of image inpainting algorithms.
Approaches These are also the next research contents in our future work.
Image 1 Image 2 Image 3
CDD model 15.1962 10.3911 6.4777
Criminisi algorithm 5.4809 5.6140 5.6792 ACKNOWLEDGMENT
Reference[8]model 1.1560 5.4563 5.5326
This work is supported by the National Science
Our algorithm 0.1297 5.3267 5.5629
Foundation of China (No.61170161, No.61300155),
TABLE III. RUNNING TIME(S)WITH DIFFERENT APPROACHES
outstanding Young Scientists Foundation Grant of
Shandong Province (No.BS2014DX016), Ph.D. Programs
Test images Foundation of Ludong University (No.LY2014033,
Approaches
Image 1 Image 2 Image 3
LY2015033).
CDD model 40.0328 38.3720 176.9678
Criminisi algorithm 35.1640 35.9750 160.9770
Reference[8]model 15.9602 22.1341 85.6324
Our algorithm 16.4930 19.5470 70.6720 REFERENCES
As shown in Fig.3, there is an obvious fracture of the roof
[1] S.M Valiollahzadeh, Nazari, M.Babaie-zadeh, “A new approach in
structure in Criminisi algorithm, and appears blur decomposition over multiple overcomplete dictionaries with applicati
phenomena in CDD model and incomplete inpainting in [8] on to image inpainting,” MLSP,IEEE International Workshop on,
model. TABLE ċ .shows that our algorithm has obvious pp.1-6, 2009.
advantage in time efficiency. Especially for image 3, our [2] M. Bertalmio, G. Sapiro, C. Ballester and Caselles,
“Image inpainti-ng,” ACM New York. pp. 417-424, 2000.
method respectively reduces the running time by 60%, 56%,
[3] T.F. Chan, J.H. Shen, “Mathematical models for local non-texture
18% compared with the CDD model, the Criminisi inpainting,” SIAM ,vol.62,pp.1019-1043, 2001.
algorithm and the reference [8] model. [4] T.F. Chan, J.H. Shen, “Non-texture inpainting by curvature-driven
In conclusion, our algorithm performs better than the diffusions,”Visual Communication and Image Representation, vol.1
other three in both visual effects and objective evaluation 2, pp.436-449, 2001.
indexes (PSNR, MAE and running time), because: [5] A. Criminisi, P. Perez, K. Toyama, “Region filling and object
removal by exemplar-based image inpainting,” .IEEE Transactions
Firstly, it ensures the spreading of the image structure on Image Processing, vol.13, pp.1200-1212. 2004.
information by introducing the structure control function [6] H.W. Cheng, C.W. Hsich, S.K. Lin, “Robust algorithm for
H ( p ) and taking the sum form instead of multiplication, exemplar-based image inpainting,” Beijing international conference
on computer graphics, imaging and vision, pp.214-224, 2005.
thereby promotes the repair effects. Secondly, the
[7] Y.L. Lin, J.H. Zhao, X.F. Zhu, “An improved algorithm for image
introduction of the structure tensor makes more precise inpaiting based on texture synthesis,” .Computer Application and
matching to repair piece with the target patches, thus Software, vol.27, pp.:11-12, 2010.
reduces the error matching rate and error accumulation rate [8] A.B. Huang, X.L. Zhu, Y.Y. Xu, “An improved image inpainting
of the original algorithm, and receives obviously algorithm based on texture synthesis,” Journal of Hefei University
improvement of the visual effect. Thirdly, convert of the of Technology, vol.34, pp.313-320, 2011.
searching way reduces the redundancy of the matching and [9] S. Ren, X.H. Tang, G.L. Kang, “An image restoration algorithm
the time complexity. combined texture and edge character,” Journal of Computer-Aided
Design & Computer Graphics, vol.25, pp.1682-1693, 2013.
[10] S. Yang, Z.Z. Yang, “Image restoration based on reference of texture
V. SUMMARY and own color,” Journal of computer applications, vol.34, pp. 1724-
1726, 1734, 2014.
In this paper we introduce the structure of information
[11] H. Nie, J. Peng, “An image restoration algorithm based on KL
measure H ( p ) to priority setting on the basis of analyzing transform and TV model,” Silicon Valley , vol. 169, pp.59-66, 2015.
the deficiencies of the large area of image restoration [12] U. Kothe, “Edge and junction detection with an improved structure
algorithm the Criminisi algorithm. Besides, we have also tensor,” Lecture Notes in Computer Science. Berlin, Springer-Verlag,
made corresponding adjustments in the matching criterion pp.25-32, 2003.
90
Authorized licensed use limited to: J.R.D. Tata Memorial Library Indian Institute of Science Bengaluru. Downloaded on July 09,2024 at 05:40:31 UTC from IEEE Xplore. Restrictions apply.