• No results found

Multiple Inpainting of low resolution images using examplar and super resolution algorithm

N/A
N/A
Protected

Academic year: 2020

Share "Multiple Inpainting of low resolution images using examplar and super resolution algorithm"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3641

Multiple Inpainting of low resolution images using

examplar and super resolution algorithm

A.Breezy Joy, C.Rekha

Abstract—Inpainting is the process of filling the missing regions in an image. The main aim of this paper is to fill the missing areas using examplar based inpainting and to recover the missing areas and improve the quality of the image using super resolution algorithm. The performance of the algorithm is evaluated using PSNR, mean square error and Histogram error. The damaged image is first downsampled. Then the image is inpainted a number of times using examplar based approach. The inpainted images are combined using loopy belief propagation. The image is finally upsampled and the image quality is improved using a super resolution algorithm.

Index Terms—examplar based inpainting, mean square error, loopy belief propagation, running time.

1. INTRODUCTION

Inpainting is used for reconstructing lost or deteriorated parts of images. Image inpainting techniques are in use over a long time for various applications like scratch removal, restoring the damaged, missing portions or removal of objects from the images, etc. In photography and cinema, inpainting is used for film restoration. To reverse the deterioration, dust spots in film and see infrared cleaning. It is also used for removing red-eye, eliminating the stamped date from photographs and removing objects for creative effect. This technique is be used to replace the lost blocks in the transmission and coding of images such as in a streaming video. It is also used to remove the logos in videos. If any unwanted portion of the image is to be removed, then the missing region can be filled using inpainting.

In a paper fragment based image completion, adaptive neighborhood algorithm is used. Here the most similar fragments from the neighborhood are selected and filled in the missing regions. The visible part of the image serve as a training set for the unknown parts. But in this method, more time is spent for searching the best matching fragments. Sometimes two fragments of same part may differ under slight illumination changes. The next paper is inpainting by patch propagation using patch sparsity. In this method the missing patches are represented by sparse linear combination of candidate patches. The patch with large structure sparsity is used for inpainting. Here only the structure of the patch is considered. Texture is not included.

Examplar based inpainting based on local geometry uses K-nearest neighbor algorithm to find the structure tensor. To find the best matching patch, template matching is performed. This method fails to replicate texture in a coherent manner. In texture synthesis method, the textural information and structural information are propagated and the patch priority is calculated. This method fails to handle curved structures. If similar patches do not exist, it does not produce

reasonable output.

In a paper statistics of patch offsets for image completion, the statistics of offsets which are sparsely distributed are obtained. Some dominant offsets provide reliable information for filling the image. A stack of shifted images are combined by optimization and it is used to fill missing region. Dominant offsets show how the patterns are repeated and give details about the missing regions. The main advantage is this method has better results and has fast image completion. But this method fails when the desired offset does not have dominant statistics. This problem can be solved only partially by introducing manual offsets.

In non parametric sampling, a markov random field model is assumed and the conditional distribution of each pixel is calculated. A number of textures are synthesized from a single texture. But some textures may slip into wrong part and produce verbatim copies of the original. Only frontal parallel textures are handled. Local linear embedding is used to generate a high resolution image from a low resolution image. Here more number of neighbours should be considered. All these above methods have low signal to noise ratio and image quality is low. These drawbacks are overcome by the proposed method.

The proposed method uses examplar based inpainting. Inpainting is performed on a coarse version of the input image. For filling the missing regions a non parametric patch sampling method is used. In this method the best matching patches from the neighborhood are chosen and they are filled in the missing region.To recover fine details on the missing areas, super resolution algorithm is used which converts the low resolution image back to high resolution image.Template matching, non local means and non negative matrix factorization. These three methods aimed at selecting the best matching pixel which is to be replaced in the place of inpainting region. The parameters like PSNR, MSE and Histogram error are estimated.

2. PROPOSED METHOD

(2)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3642

Fig.2.1Block diagram for inpainting 3. EXAMPLAR BASED INPAINTING

The first step in image inpainting is to convert the high resolution image into low resolution image into low resolution image. For this converting process a Gaussian pyramid decomposition is performed. A low pass filtering operation is performed on the image pixels. Downsampling is necessary because the low resolution images are easier to inpaint. Low resolution images are contaminated by noise. Local orientation singularities which affect the filling process are strongly reduced if low resolution images are used.

After converting into low resolution images, mark the target region

to be filled using region of interest. The remaining part of the image is the source region from which the neighbouring patches are selected.

I

A Boolean matrix is constructed which stores a binary value 1 for pixel to be inpainted and binary value 0 for the other pixels. This matrix is called fill region. The next step is to find the boundary of marked region

by convolving the fill region with laplacian filter. The next step is to find the priority of the patch which is to be filled first. Texture synthesis is performed which copies the samples from the neighbourhood and replaced in the missing region.

3.1 FIND PATCH PRIORITY

The missing patch which has the highest priority is to be found. Priority is the patch which has less unknown regions. The patch priority is given by the product of data term and confidence term.

P(p) = C(p) D(p)

Where P(p) is the patch priority C(P) is the confidence term D(p) is the data term

Data term can be either a tensor based or sparsity based data terms. Tensor based priority term is given by

m

i

T

Ii

Ii

J

1

Where J is the sum of structure tensors of each scalar image channels. The scalar structure tensor undergoes smoothing operation by

J

G

J

Where

G

is the Gaussian distribution with standard deviation

. A similarity weight is measured between the known

patches and the unknown patch. For any selected patch, a collection of neighbouring patches with highest similarities are distributed in the same structure or texture. The confidence values of structure for a patch are measured by the sparseness of its non-zero similarities to the neighbouring patches. The patch which is more sparsely distributed with non zero similarities is placed on the fill front due to more structure sparseness. For a patch located at the fill front

, a neighborhood window N (p) is set with centre p.

3.2 TEXTURE SYNTHESIS

Texture synthesis is the process of algorithmically constructing a large digital image by taking advantage of the structural content. Texture synthesis is used for filling the missing parts. The patch which has the highest priority is filled first. To fill a patch, the most similar patch from the remaining part of the image is taken. A similarity metric is used to find the best matching patch.

Texture synthesis is of two types. Pixel based texture synthesis and patch based texture synthesis. In pixel based method, a texture is synthesized in scan line order by finding and copying pixels with most similar local neighborhood as the synthetic texture. This method is very useful for image completion.

IMAGE

N

Inpainting 1

Inpainting2

Inpainting 3

Belief

propagation

SR

algorithm

Enhanced

image

(3)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3643

In patch based texture synthesis, a new texture is created by copying and stitching the textures at various offsets. This method is more effective and faster than pixel based texture synthesis. The chosen patch should have maximum similarity between the known pixel values of the current patch to be filled and the co-located pixel values.

Coherence measure is given by

))

,

(

(

min

)

(

j x S j

x p SSD p p

p

d

coh

dSSD- sum of square differences Ψpx - current patch

Ψpj – neighbouring patch

Coherence measure is the degree of similarity between the synthesized patch and the original patch. The chosen neighbor should lie within

(

1

)

d

min where

min

d

is the minimum distance between the current patch and the closest neighbor.

If the selected patch does not satisfy this condition, then the filling process is stopped and the priority of the current patch is decreased. Again the patch with highest priority is chosen. The unknown parts are pasted using the best matching patch by direct sampling. Alpha blending is used to combine the known part and the source patch. Alpha blending is the process which displays a bitmap which has transparent or semi transparent pixels. The image is made transparent and the known part and unknown part are combined together. Poisson fusion is the process used to hide the seams. The unevenness caused in the image in the inpainting process is corrected by using Poisson fusion. Patch size and filling order must be considered. Patch size can be 5

5, 7

7, 9

9, 11

11 etc. a parameter M is considered which is the number of times inpainting is done.

3.3 LOOPY BELIEF PROPAGATION

LBP is a message passing algorithm. A node is used to pass a message to the adjacent node only when it has received all the messages, eliminating the message from the destination node to itself. In the same way, all the inpainted images are combined together using loopy belief propagation. A label is assigned to each pixel of the unknown regions T of the image. A major drawback of belief propagation is that it is slow when the number of labels is high. So loopy belief propagation is used to avoid this complexity.

To solve the problems like blur and spatial consistency, there is a need to minimize the objective function. The number of labels assigned must be equal to the number of patches in the source region. In loopy belief propagation, the number of labels is small. Label is the index of the inpainted image from which the patches are extracted. A label is assigned for each pixel so that the total energy E of the markov random field is minimized.

Energy of MRF is given by

E(l)=∑ vd(lp) + ∑ Vs(ln , lm) vd (lp) is the label cost

Vs (ln , lm) is the discontinuity cost

The cost increases when the similarity between the current patch and collocated patches are less. Discontinuity cost is the difference between labels. λ is the weighing factor and it is set to 100.Using loopy belief propagation, minimization of energy E is performed over the target region T and it corresponds to maximum a posteriori (MAP) estimation problem. When λ is 0, there is no smoothness term. Some artifacts are visible. A good trade-off is obtained by setting the value of λ to100. 4. SUPER RESOLUTION ALGORITHM

After combining all the inpainted images, a super resolution algorithm is used to recover back the high resolution image from the low resolution image. The downsampled image is upsampled. It is also used to improve the quality of the image. In low resolution image, the pixel density within an image is small. Hence it offers fewer details. In a high resolution image, the pixel density is larger. Hence it offers more details. Super resolution is the process of obtaining a high resolution image to low resolution image. To increase the image resolution, the pixel size is reduced by increasing the number of pixels per unit area. But the amount of light available per pixel also decreases. The chip size can be reduced but the increase of capacitance leads to storage problem. SR image reconstruction is computationally effective and cost is less.

5. ALGORITHM FOR INPAINTING

 Read an image and find the size of the image. Using median filter, filter the image which replace the pixel value with the neighbourhood of its value.

 Convert the RGB colour image into gray scale image. Create a mask which is completely filled with 0 and the area to be inpainted is marked as 1.

 Create a label matrix which indicates the label for the connected components and used to mark the part of region to be inpainted.

 To set the boundary (Ymax, ymin, Xmax, Xmin) in the

inpaint image, compute the values using the below mentioned equations

1. Ymin=min(row)-1

2. Ymax=max(row)+1

3. Xmin=min(column)-1

4. Xmax=max(column)+1

 Calculate the nearest matching pixel in column and row,

Matching pixel row, A= (Ymax-Ymin)+1

Matchingpixelcolumn, B= (Xmax-Xmin) +1

 Find the bottom, top, left and right area of the image, 1. Bottom Area Range (BAR) & Bottom Mean

If (Ymax+A) <= width of the image, then BAR=

(Ymin+A) to (Ymax+A) in x direction

=Xmin to Xmax in y direction.

Otherwise,

BAR = (Ymin+A) to width of image in x direction

(4)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3644

∑1, 2….n pixels/ (number of pixels) =mean (BAR) 2. Top area range (TAR) & top mean

If (Ymin-A) >= 1, then

TAR= (Ymin-A) to (Ymax-A) in x direction

TAR=Xmin to Xmax in y direction.

Otherwise,

TAR=1 to (Ymax-A) in x direction

=Xmin to Xmax in y direction.

∑1, 2….n pixels/ (number of pixels)=mean(TAR) 3. Right area range (RAR) & right mean

If (Xmax+B) <= height of the image then,

RAR=Ymin to Ymax in x direction

=(Xmin+B) to (Xmax+B) in y direction.

Otherwise,

RAR=Ymin to Ymax in x direction

=(Xmin-B) to height of image in y direction.

∑1,2….n pixels/(number of pixels)=mean(RAR) 4. Left area range (LAR) & right mean

If (Xmin-A) >= 1, then,

LAR=Ymin to Ymax in x direction

=(Xmin-B) to (Xmax-B) in y direction.

Otherwise,

LAR=Ymin to Ymax in x direction

=1 to (Xmax-B) in y direction.

∑1,2….n pixels/(number of pixels)=mean(LAR)

 In template matching method, the maximum of the mean values of bottom, top, left and right area are calculated. The area to be inpainted is replaced by the maximum of the above four mean values.

 In NLM method, if (bottom mean-top mean) is greater than 20, assume the top to bottom value as 0, otherwise 1.

 If (left mean-right mean) is greater than 20, then the left to right value is 0, otherwise 1.

 If both top to bottom and left to right values are 1, then the inpainting area is replaced by,

pixel=mean(bottom,top,right,left);

 If top to bottom value is 1 and left to right value is 0 then the inpainting area is replaced by,

Pixel=mean (bottom_mean, top_mean)

 If the top to bottom value is 0 and left to right value is 1, then the inpainting region is replaced by

Pixel=mean (right_mean,left mean)

 If both top to bottom value and left to right are 0, and (left mean-right mean) > (bottom mean-top mean), then the inpainting region is replaced by,

Pixel=mean (bottom_mean, top_mean)

Otherwise the pixels are replaced by pixel=mean (right_mean, left_mean)

 In NMF method, consider a temporary value. If the miss image is less than 10, the inpainting region is replaced by

Missing pixel= max (temporary value)

 Finally the image has to be enhanced. Median filter is used to filter the images obtained from the three methods and hence the image quality is increased.

 The performance of inpainting is evaluated by calculating PSNR mean square error and histogram error.

6. RESULTS AND DISCUSSION

The final output consists of the input image, inpainted image, TM image, NLM image and NMF image. First the input image is displayed. Next the binary mask is displayed in which the region to be inpainted is in white colour and the remaining portion is displayed as black. The region to be inpainted has the pixel value 1 and the remaining part has the pixel value 0. Three methods of inpainting are performed and their outputs are displayed. The image quality is improved and the downsampled image is converted back to high resolution image. The three methods include Template matching (TM), non local means (NLM) method and non negative matrix factorization (NMF) method. Output of each method is displayed.

Then signal to noise ratio is measured for the three images. But it does not have much variation. Next mean square error is calculated. MSE also does not have considerable changes among the three images. Finally histogram error is calculated. Histogram error is less in TM image than the other two images. Hence experimental results show that among the three methods, TM image is better. Three parameters, signal to noise ratio, mean square error and Histogram error are estimated to evaluate the performance of the three methods. Template matching is better than the other two methods.

(5)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3645

6.1 Comparison of PSNR, MSE and Histogram Error

Image name Method PSNR MSE Histogram Error Baby TM 49.3500 0.7552 2.7458e-005

[image:5.595.60.551.471.751.2]

NLM 49.2528 0.7723 3.1116e-005 NMF 49.3539 0.7545 2.8679e-005 Leaf TM 30.4311 26.8806 2.3023e-004 NLM 30.4109 26.1553 3.1217e-004 NMF 30.4445 26.6987 3.2135e-004 nature TM 38.0800 10.1177 8.7285e-005 NLM 38.0730 10.1340 8.9937e-005 NMF 38.0841 10.1082 9.2380e-005 blue TM 36.8829 13.3287 2.1635e-004 NLM 36.8840 13.3254 2.9234e-004 NMF 36.8841 13.3252 2.4539e-004

Table 6.1 Comparison of PSNR, MSE and Histogram Error

Original image damaged image inpainting region

(6)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3646

Input image damaged image inpainting region

TM image NLM image NMF image

Input image Damaged image Inpainting area

(7)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3647

Input image Damaged image Inpainting area

TM image NLM image NMFimage 7. CONCLUSION

Thus the inpainting was done for a series of images using examplar based inpainting First the input image is downsampled to make the inpainting easier. Then inpainting is done for a number of times using three methods of inpainting. They are template matching (TM), non local means (NLM) and non negative matrix factorization (NMF). Finally a super resolution algorithm is used to improve the quality of the image. It undergoes a filtering operation to reduce the noise in the image. Among the three methods, the PSNR and mean square error does not show much variation. But histogram error is low for TM image as compared to the other two methods. Hence template matching is the best method suitable for inpainting. Future work would be to extend this to other super resolution methods and also to improve the image quality after inpainting.

REFERENCES

[1] M. Bertalmio, G. Sapiro, V. Caselles, and C. Ballester, ―Image inpainting,‖ in Proc. 27th Annu. Conf. Comput. Graph. Interact. Tech., Jul. 2000, pp. 417–424.

[2] D. Tschumperlé and R. Deriche, ―Vector-valued image regularization with PDEs: A common framework for different applications,‖ IEEE Trans. Pattern Anal. Mach. Intell., vol. 27, no. 4, pp. 506–517, Apr. 2005.

[3] T. Chan and J. Shen, ―Variational restoration of non-flat image features: Models and algorithms,‖ SIAM J. Appl. Math., vol. 61, no. 4, pp. 1338–1361, 2001.

[4] A. Criminisi, P. Pérez, and K. Toyama, ―Region filling and object removal by examplar-based image inpainting,‖

IEEE Trans. ImageProcess., vol. 13, no. 9, pp. 1200–1212, Sep. 2004.

[5] I. Drori, D. Cohen-Or, and H. Yeshurun, ―Fragment-based image completion,‖ ACM Trans. Graph., vol. 22, no. 2003, pp. 303–312, 2003.

[6] P. Harrison, ―A non-hierarchical procedure for re-synthesis of complex texture,‖ in Proc. Int. Conf. Central Eur. Comput. Graph., Vis. Comput.Vis., 2001, pp. 1–8. [7] C. Barnes, E. Shechtman, A. Finkelstein, and D. B. Goldman, ―Patch- Match: A randomized correspondence algorithm for structural image editing,‖ ACM Trans. Graph., vol. 28, no. 3, p. 24, Aug. 2009.

[8] A. A. Efros and T. K. Leung, ―Texture synthesis by non-parametric sampling,‖ in Proc. 7th IEEE Comput. Vis. Pattern Recognit., Sep. 1999, pp. 1033–1038.[9] O. Le Meur, J. Gautier, and C. Guillemot, ―Examplar-based inpainting based on local geometry,‖ in Proc. 18th IEEE Int. Conf. Image Process., Sep. 2011, pp. 3401–3404.

[10] O. Le Meur and C. Guillemot, ―Super-resolution-based inpainting,‖ in Proc. 12th Eur. Conf. Comput. Vis., 2012, pp. 554–567.

[11] S. Dai, M. Han, W. Xu, Y. Wu, Y. Gong, and A. Katsaggelos, ―SoftCuts: A soft edge smoothness prior for color image super-resolution,‖ IEEETrans. Image Process., vol. 18, no. 5, pp. 969–981, May 2009.

[12] W. T. Freeman, T. R. Jones, and E. C. Pasztor, ―Example-based superresolution,‖ IEEE Comput. Graph. Appl., vol. 22, no. 2, pp. 56–65, Mar.–Apr. 2002.

[13] D. Glasner, S. Bagon, and M. Irani, ―Super-resolution from a single image,‖ in Proc. IEEE Int. Conf. Comput. Vis., vol. 10. Oct. 2009, pp. 349–356.

(8)

ISSN: 2278 – 1323 All Rights Reserved © 2014 IJARCET

3648

[15] Y. Wexler, E. Shechtman, and M. Irani, ―Space-time video completion,‖ in Proc. IEEE Comput. Vis. Pattern Recognit., Jun.–Jul. 2004, pp. I-120–I-127.

[16] Z. Xu and J. Sun, ―Image inpainting by patch propagation using patch sparsity,‖ IEEE Trans. Image Process., vol. 19, no. 5, pp. 1153–1165,

May 2010.

[17] S. Di Zenzo, ―A note on the gradient of a multi-image,‖

Comput. Vis., Graph., Image Process., vol. 33, no. 1, pp. 116–125, 1986.

[18] J. Weickert, ―Coherence-enhancing diffusion filtering,‖

Int. J. Comput. Vis., vol. 32, nos. 2–3, pp. 111–127, 1999. [19] J. Kopf, W. Kienzle, S. Drucker, and S. B. Kang, ―Quality prediction for image completion,‖ ACM Trans. Graph., vol. 31, no. 6, p. 131, 2012.

[20] A. Bugeau, M. Bertalmío, V. Caselles, and G. Sapiro, ―A comprehensive framework for image inpainting,‖ IEEE Trans. Image Process., vol. 19, no. 10, pp. 2634–2644, Oct. 2010.

[21] D. D. Lee and H. S. Seung, ―Algorithms for non-negative matrix factorization,‖ in Advances in Neural Information Processing System. Cambridge, MA, USA: MIT Press, 2000.

[22] A. Buades, B. Coll, and J. Morel, ―A non local algorithm for image denoising,‖ in Proc. IEEE Comput. Vis. Pattern Recognit., vol. 2. Jun. 2005, pp. 60–65.

[23] P. Pérez, M. Gangnet, and A. Blake, ―Poisson image editing,‖ in Proc. SIGGGRAPH, 2003, pp. 313–318. [24] N. Komodakis and G. Tziritas, ―Image completion using efficient belief propagation via priority scheduling and dynamic pruning,‖ IEEE Trans.Image Process., vol. 16, no. 11, pp. 2649–2661, Nov. 2007.

[25] Y. Boykov, O. Veksler, and R. Zabih, ―Efficient approximate energy minimization via graph cuts,‖ IEEE Trans. Pattern Anal. Mach. Intell., vol. 20, no. 12, pp. 1222–1239, Nov. 2001.

[26] Y. Boykov and V. Kolmogorov, ―An experimental comparison of mincut/ max-flow algorithms for energy minimization in vision,‖ IEEE Trans.

Pattern Anal. Mach. Intell., vol. 26, no. 9, pp. 1124–1137, Sep. 2004.

[27] J. Yedidia, W. Freeman, and Y. Weiss, ―Constructing free energy approximations and generalized belief propagation algorithms,‖ IEEETrans. Inf. Theory, vol. 51, no. 7, pp. 2282–2312, Jul. 2005.

[28] A. Blake and A. Zisserman, Visual Reconstruction. Cambridge, MA, USA: MIT Press, 1987.

[29] Y. Pritch, E. Kav-Venaki, and S. Peleg, ―Shift-map image editing,‖ in Proc. Int. Conf. Comput. Vis., Sep. 2009, pp. 151–158.

[30] K. He and J. Sun, ―Statistics of patch offsets for image completion,‖ in Proc. 12th Eur. Conf. Comput. Vis., 2012, pp. 16–29.

[31] J. Hays and A. A. Efros, ―Scene completion using millions of photographs,‖ ACM Trans. Graph., vol. 26, no. 3, p. 4, 2007.

[32] O. Whyte, J. Sivic, and A. Zisserman, ―Get out of my picture! Internetbased inpainting,‖ in Proc. 20th Brit. Mach. Vis. Conf., 2009, pp. 1–11.

Breezy Joy A received the B.E degree in Electronics and Communication Engineering from Anna University, Chennai, 2013.She is currently doing his master of engineering in Communication systems in Pet engineering college, vallioor. Her areas of interests include image processing, communication and wireless systems.

Rekha C received the B.E degree in Electronics and Communication Engineering from Anna University, Chennai, 2005 and M.E degree from Anna University, Tirunelveli, 2011. She is currently working as an Assistant Professor in Department of Electronics and communication in Pet engineering College, Vallioor. Her research areas include antennas theory, microwave

References

Related documents

For the purposes of this study, 27 students in two Fundamentals of Technology classes were chosen to participate in a one week unit focused on the principles and elements of

ABSTRACT : Cancer is the cause of death all over the world and the number of deaths due to cancer has been increasing at a very high rate and it has become a

of strain 18. All of the mak- mutations reported to be bypassed by [KIL-b] in meiosis were also bypassed in cytoduction. Had we been dealing with delayed expression

In very general terms, the natural risk concept is bilateral: earth science and social science follow different approaches, which are implicit in the previous discussion

For understanding Bangladeshi banking system, it is very important to understand the factors that are helping different countries of the world to establish a strong economy

Popoola T.A (2002), “Design, construction and testing of an infrared remote control system” on October, final year project submitted to the department of electrical

These results highlight the risk of misleading conclusions based on the standard Granger causality tests which neither accounts for structural breaks nor time variation

An electric light is a converter; its prime purpose is the transformation of electrical energy into visible electromagnetic radiation. It is the most common form