You are currently viewing a new version of our website. To view the old version click .
Mathematics
  • Article
  • Open Access

3 August 2022

Image Inpainting for 3D Reconstruction Based on the Known Region Boundaries

,
,
,
,
and
1
College of Electronic and Information Engineering, Southwest University, Chongqing 400715, China
2
Science and Technology Department, Chongqing University of Education, Chongqing 400065, China
3
People’s Procuratorate of Beijing Municipality, Beijing 100078, China
*
Author to whom correspondence should be addressed.
This article belongs to the Special Issue Computational Algebraic Topology and Neural Networks in Computer Vision

Abstract

Pointcloud is a collection of 3D object coordinate systems in 3D scene. Generally, point data in pointclouds represent the outer surface of an object. It is widely used in 3D reconstruction applications in various fields. When obtaining pointcloud data from RGB-D images, if part of the information in the RGB-D images is lost or damaged, the pointcloud data will be hollow or too sparse. Moreover, it is not conducive to the subsequent application of pointcloud data. Based on the boundary of the region to be repaired, we proposes to repair the damaged image and synthesize the complete pointcloud data after a series of preprocessing steps related to the image. Experiments show that the our method can effectively improve the restoration of the lost details of the pixel in the target area and that it will have the fuller pointcloud data after synthesizing the restored image.
MSC:
54H30; 65D18

1. Introduction

Image inpainting refers to a technology in which the information in the local area of an image is lost. The purpose of image inpainting is to restore this information. In the field of traditional image inpainting, there have been many methods, such as the fast marching method (FMM) proposed by Telea [], which has a better inpainting effect for small-scale images with small pixel differences and semantically poor images with missing areas. However, for large areas, large pixel differences and language-rich images with missing areas are very lacking in repairing effects, incoherent chromaticity in repaired areas, blurred content, and missing texture information. Criminisi [] proposed the block-based image inpainting method (BBIM). This method considers texture information compared with the FMM. If the information of the object to be repaired is more complex or involves areas where multiple texture structures intersect, there will be repair dislocation and incomplete pixel filling, and it will lead to missing or empty results in the generated pointcloud data.
The FMM and BBIM all first obtain the mask image according to the binarization of the damaged image, then repair the original image based on the mask image. The missing pixel information in the image’s damaged area is not uniform, or the pixel value of the damaged boundary area is not far from the normal value; the set binarization threshold range is too small. This will cause the effective information extracted from the mask image to be incomplete. As a result, the repair is synsemantic and the information of the pointcloud data is lost.
From these conditions, in order to obtain complete pointcloud data for subsequent 3D reconstruction and other related applications, we propose the following optimization scheme.
(1) For large image inpainting, the original image is divided into blocks, and only the image blocks that need to be restored are selected for subsequent operations. This reduces repair time and increases efficiency.
(2) When the pixel value of the damaged area is uniform, the extracted mask image is relatively complete. It also can fully cover the required repair area. However, the image damage is not deliberately damaged, and the lost pixel information is often uneven. The mask image extracted at this time needs to undergo two expansion processes to make it cover the damaged area as much as possible.
(3) The mask image after the expansion process was combined with the original image for inpainting. There are often some subtle holes that are not completely repaired. At this time, even a second repair is already saturated. Based on this, image sharpening is performed on the area to be repaired in order to avoid disturbing the intact area. It alse can enhance the information of the area to be repaired, and then the mask image is extracted by binarization for subsequent inpainting.
In this paper, we consider the characteristics of the image to be repaired with vertical scratches (pixel values decay with the center of the scratches to both sides), which is not reflected in the original method. Secondly, in view of the shortcomings of the basic method, such as long repair time and low repair efficiency, we propose an image block parallel repair method to speed up the image repair speed and improve the repair efficiency.

3. Base Algorithm Overview

3.1. Fast Marching Method

Let Ω be the area to be repaired, and δ Ω be the boundary of the area. Take a point p on regional boundary, and we specify p as the center to select the area that does not need to be repaired around p. The pixel value of point p is approximated by the pixel value inside the small neighborhood B( ϵ ) with ϵ as the scale. Let q be a point in B( ϵ ). Giving the pixel value I ( q ) of q and the gradient value of I ( q ) , then we can use q to calculate the gray value of p point, such as Equation (1) []:
I q ( p ) = I ( q ) + I ( q ) ( p q ) .
The calculation equation of pixel value of point p is:
I ( p ) = q ε B ε ( p ) ω ( p , q ) [ I ( q ) + I ( q ) ( p q ) ] q ε B ε ( p ) ω ( p , q ) .
The weight function ω ( p , q ) is used to limit the contribution of each pixel in the neighborhood. The detailed information of the image edge is transmitted toward the region to be repaired through the ω ( p , q ) . In this method, take the point p as the center and the size of Ω is taken as the neighborhood of the area to be repaired. Then the gradient of p is calculated through this neighborhood. The gradient of p is the average of the largest gradients in the previous points. Finally, the information of the image is transmitted to the area that needs to be repaired according to the iso-illuminance line c ( p ) :
ω ( p , q ) = π 2 μ | p q | e x p ( μ 2 2 ε 2 | c ( p ) · ( p q ) | 2 ) .
The repair process needs to use Equation (1) to repeatedly traverse all discrete points, increasing the distance of the initial boundary Ω . The FMM method process is shown in Figure 1.
Figure 1. FMM process.

3.2. The Block-Based Image Inpainting Method

The BBIM proposed by Criminisi [] uses the known area of the image to fill the area to be repaired. It also determines the filling order according to the calculation priority. The filling content is a pixel block of a custom size.
Divide the image to be repaired into a known area Φ and a region Ω to be inpainted in Figure 2a. Set δ Ω as the front of fill area. In Figure 2b, taking point p ( p δ Ω ) as the center, the region defined by ψ p . With ψ p as the target matching region, match similar regions on the boundary between two textures in a known region, such as ψ q , ψ q in Figure 2c. Finally, select the best matching region for filling in Figure 2d.
Figure 2. Structure propagation by known area texture synthesis. (a) Input. (b) Determine the point to be repaired. (c) Find the best matching block. (d) Fill the neighborhood to be repaired.
The method for calculating edge contour filling priority is given by
P ( p ) = C ( p ) · D ( p ) .
From Figure 3, the direction pointed to by n p represents the normal tangential direction of the edge contour, I p is a 90° rotation of the pixel gradient direction of point p. Through these two variables, we can get the confidence term and data term:
C ( p ) = q ε Ψ p Ω ¯ C ( q ) | Ψ p | , D ( p ) = | I p · n p | a .
Figure 3. The process diagram of calculating the filling priority of image edge contour.
In Equation (5), ψ p is the area of ψ p , a is normalizing factor and its ordinary value is 255, I p = ( I x , I y ) , I as the image of binaryzation, and I x and I y are the gradients in the x and y directions. The final available n p = ( I x , I y ) . The maximum value of P ( p ) obtained from Equation (4) is selected as the center, and the scale is Ψ p ^ ( n x n ) .
Select the region Ψ q ^ which has the minimum mean squared error with Ψ p ^ in the known regions of the image.
Finally, texture and structure information is passed and C ( p ) is updated. This process occurs when Ψ p ^ is replaced by a new pixel value, and c ( p ) is constantly updated, as shown in Equation (6):
C ( p ) = C ( q ^ ) .

5. Final Results

5.1. Image Inpainting

The common damage of images, such as vertical scratches, scratches of any shape, and dust, seriously affect the quality of images. The vertical scratch is a kind of continuous damage, strip shape. The pixel value of the damaged area is attenuated chord distribution, that is the pixel value of the damaged area decreases with the increase of the distance from the center area [], as shown in Figure 9. Here, we artificially created images with vertical scratches, as shown in Figure 10a. Figure 9b is the magnification effect diagram of the damaged area boundary in Figure 9a.
Figure 9. Input image. (a) Input. (b) Edge amplification result of damaged area.
Figure 10. RGB image inpainting results. (a) Input. (b) Mask. (c) FMM results. (d) BBIM results. (e) Ours (based on FMM). (f) Ours (based on BBIM). (g) Ground truth.
This experiment is implemented in a laptop environment with an Intel(R) Core (TM) i5-9300H CPU@2.40GHz, 8.0 GB memory and 64-bit Windows 10, using Python 3.6 as the algorithm platform.
In order to verify the effectiveness of our proposed method, the images used in this paper are mainly NYU-Depth V2 dataset and Redwood dataset images. The NYU-Depth V2 dataset contains 1449 annotated RGB images and depth images with the size of 640 × 480. The image structure of Redwood dataset is the same as the NYU-Depth V2. We selected representative indoor scenes from these two datasets, such as living rooms, bedrooms, etc. The peak signal-to-noise ratio (PSNR) is used as the objective evaluation index of the restoration effect.
The experimental content is to use the improved method based on FMM and BBIM to repair the image, and compare with the original method to repair the image, and use PSNR to reflect the difference between the repair effect before and after the improvement.
The calculation method of PSNR is as follows:
M S E = 1 m n i = 0 m 1 j = 0 n 1 S ( i , j ) J ( i , j ) 2
P S N R = 10 · log 10 ( Z m a x 2 M S E ) ,
where m and n represent the image width and height, respectively, Z m a x represents the maximum gray value of all pixels in the image, S represents the original image, and J represents the restored image.
Both the FMM method and BBIM method rely on known information of damaged region boundaries for image inpainting. But for the image to be repaired with vertical scratches, the pixel values of the boundary of the damaged area are attenuated chord distribution. When binaryzation is used to extract the mask image, the boundary is not completely extracted. In this way, the edge damaged areas that we did not extract during image inpainting are also treated as known area information. These pixel values, as known information of the damaged boundary, become a reference instead of the damaged region pixel values. So the final FMM method and BBIM method repair effect is not ideal, as shown in Figure 10c,d.
In view of the situation that the pixels of the image are lost due to the vertical scratches (as in the mask, the FMM method, and BBIM method), we use morphological analysis optimizations and update the masks by dilation and sharpening. After processing, the effect of image restoration is more ideal, such as in Figure 10e,f. We also use PSNR to represent the results of image inpainting, as shown in Table 2.
Table 2. RGB Image PSNR Results.
Because we use the pointcloud generated by RGB-D Odometry Method, the RGB image and depth image become two important factors affecting the pointcloud. In Table 2, PSNR is used as the evaluation standard of the RGB image inpainting results. In order to comprehensively consider the two factors, we add the same scratches as RGB images to the depth image of the input image in Figure 10a and repair them. The results of PSNR are used to evaluate the results of depth image repair, such as in Table 3. The results of Table 3 show that for the inpainting of depth images, the FMM method and BBIM method after the proposed method are more effective than the original basic method.
Table 3. Depth image PSNR results.

5.2. Multithread Image Inpainting Result

The BBIM method is based on the principle of image block matching repair, and its basic idea is similar to that of FMM method. It introduces the concept of priority as a condition for filling pixel sequence selection. When repairing an image by the BBIM method, the first image block is selected from the area to be repaired and replaced by matching until the last image block of the area to be repaired is calculated. In order to shorten the repair time, we divide the image into blocks for multithreading repair.
According to the size of the input image, the number of input image blocks is calculated according to the principle of image block. The binary mask image processed by dilation method is also divided into the same blocks as the input image. In the basic BBIM method and FMM method, especially for block matching based on the BBIM method, it takes a lot of time to calculate the priority of filled blocks. In the process of image inpainting by using the BBIM method, a block with the highest priority is found according to the global image to fill the repair area. If the input image size is too large, it will also increase the calculation time for calculating the priority selection of filling blocks. In the local continuous region of the image, most of the pixels closer to the position have similar pixel information. Therefore, we divide the image to be repaired into several image blocks with the same size as the mask image, and repair these image blocks at the same time. Because the size of the image block becomes smaller and multiple repair areas are processed at the same time, the efficiency of image is effectively improved. We calculate the repair time of RGB images and depth images in Figure 10a, and the results are shown in Table 4 and Table 5.
Table 4. RGB Image inpainting time results.
Table 5. Depth Image inpainting time results.
The method of multi-thread repair in sub-regions is used, which improves the timeliness of the method and speeds up the repair speed.

5.3. Generate Pointcloud Data Result

Our pointcloud generation method is based on the RGB-D odometry method. Pointclouds generated by using broken RGB images and depth images are shown in Figure 11a. The damaged area of the RGB image causes holes in pointcloud data. The pointcloud data repaired by using the FMM method and BIMM method are shown in Figure 11b,c. Because the boundaries of unextracted damaged areas are introduced in the repair process, and the boundaries of these damaged areas are used as reference information for repair, the repair effect is unsatisfactory. The broken RGB image we used in the process of generating pointcloud results in a hole in pointcloud data.
Figure 11. Effect of our simple post-processing. (a) The original pointcloud. (b) The pointcloud of FMM. (c) The pointcloud of BBIM. (d) Ours (based on FMM). (e) Ours (based on BBIM). (f) Ground truth.
Because the RGB image has scratches, the pointcloud generated by RGB-D will produce a pointcloud missing as shown in Figure 11a. Each pixel value in the depth image represents the plane distance between the scene object and the camera. If the depth image has scratches, the pointcloud depth error shown in Figure 12a will occur. Figure 12b,c is the pointcloud synthesized by using the basic FMM and BBIM methods to repair the depth image. As the result of RGB image inpainting, the boundary of the area to be repaired in the depth image is not completely repaired, so the depth information of the boundary of the area will be wrong, which will affect the generated pointcloud.
Figure 12. Left view of pointcloud. (a) Tthe original pointcloud. (b) The pointcloud of FMM. (c) The pointcloud of BBIM. (d) Ours (based on FMM). (e) Ours (based on BBIM). (f) Ground truth.
Figure 11d,e and Figure 12d,e show the pointcloud data processed by the proposed method combined with FMM method and BBIM method, and the repair effect is improved. However, it can be seen from the side view that even if the repair effect is improved compared with Figure 12b,c, there are still subtle incomplete parts in the scratch boundary area, which leads to some errors in the depth information of the boundary.

6. Conclusions

We propose a new method for processing image inpainting, which is based on the FMM proposed by Telea and BBIM proposed by Criminisi, and which combines some image-processing methods, such as the dilation method for mask image, operations on sharpening, and image block processing of image.
We have proved that the above two repair methods combined with the our method can achieve better repair results. It can also better reflect the texture information of the damaged area, and the repair speed is faster. The repaired pointcloud data fills in the information of the defective area, so that it can better reflect the three-dimensional space state of the object. It is more conducive to the extraction and segmentation of the target object when using the pointcloud data for 3D reconstruction and other applications.

7. Future Works

The purpose of pointcloud hole filling is to fill the sparse, incomplete or noisy and uneven data collected by 3D sensors. Applying high-quality pointclouds to 3D reconstruction and other fields. This paper is based on the RGB-D Odometry method to convert RGB-D image pairs into pointcloud and render visualization together. So the image quality of the RGB-D dataset directly affects the quality of the pointcloud. In the future, we will first focus on how to efficiently select the known region information for complex RGB-D dataset to repair images and fill pointcloud data. Secondly, we will focus on the problem of pointcloud filling in overlapping regions, because this problem has been limited by 2D image restoration. In the existing pointcloud restoration technology, few technologies focus on detailed feature preservation and pointcloud edge information. We will focus on the edge information of images and the pointcloud, which can also be used for the accurate segmentation of images and pointclouds.

Author Contributions

Software, W.W., L.Z. and Z.L.; writing—original draft, H.Y.; writing—review & editing, Z.D. and J.H. All authors have read and agreed to the published version of the manuscript.

Funding

This manuscript was supported in part by Research Grant from MOE (Ministry of Education in China) Project of Humanities and Social Sciences (Grant number 18YJC880008), Project‘future school(infant education)’ of National Center For Schooling Development Programme of China (Grant number CSDP18FC1201), Natural Science Foundation of Chongqing Municipality in China (Grant number cstc2018jcyjAX0835), and the Scientific Research Project Foundation of Chongqing University of Education (Grant numbers KY2018TZ01, 19GSKP01 and KY201903A).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Alexandru Telea. An Image Inpainting Technique Based on the Fast Marching Method. J. Graph. Tools 2004, 9, 23–34. [Google Scholar] [CrossRef]
  2. Criminisi, A.; Perez, P.; Toyama, K. Region Filling and Object Removal by Exemplar-Based Image Inpainting. IEEE Trans. Image Process. 2004, 13, 1200–1212. [Google Scholar] [CrossRef] [PubMed]
  3. Bertalmio, M.; Sapiro, G.; Caselles, V.; Ballester, C. Image Inpainting. In Proceedings of the 27th Annual Conference on Computer Graphics and Interactive Techniques, New Orleans, LA, USA, 23–28 July 2000. [Google Scholar]
  4. Tfc, A.; Js, B. Nontexture Inpainting by Curvature-Driven Diffusions. J. Vis. Commun. Image Represent. 2001, 12, 436–449. [Google Scholar]
  5. Shen, C.J. Mathematical models of local non-texture inpaintings. Siam J. Appl. Math. 2002, 62, 1019–1043. [Google Scholar] [CrossRef]
  6. Shen, J.; Kang, S.H.; Chan, T.F. Euler’s Elastica and Curvature-Based Inpainting. Siam J. Appl. Math. 2003, 63, 564–592. [Google Scholar] [CrossRef]
  7. Tsai, A.; Yezzi, A.; Willsky, A.S. Curve evolution implementation of the Mumford-Shah functional for image segmentation, denoising, interpolation, and magnification. IEEE Trans. Image Process. 2001, 10, 1169–1186. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  8. Esedoglu, S. Digital Inpainting Based On The Mumford-Shah-Euler Image Model. Eur. J. Appl. Math. 2003, 13, 353–370. [Google Scholar] [CrossRef] [Green Version]
  9. Luo, K.; Li, D.; Feng, Y.; Zhang, M. Depth-aided inpainting for disocclusion restoration of multi-view images using depth-image-based rendering. J. Zhejiang Univ. Sci. A 2009, 10, 1738–1749. [Google Scholar] [CrossRef]
  10. Xu, Z.; Sun, J. Image inpainting by patch propagation using patch sparsity. IEEE Trans. Image Process. 2010, 19, 1153–1165. [Google Scholar] [PubMed]
  11. Anamandra, S.H.; Chandrasekaran, V. Exemplar-based color image inpainting using a simple and effective gradient function. In Proceedings of the 2010 International Conference on Image Processing, Computer Vision, & Pattern Recognition, Las Vegas, NV, USA, 12–15 July 2010. [Google Scholar]
  12. Huang, J.B.; Kang, S.B.; Ahuja, N.; Kopf, J. Image completion using planar structure guidance. ACM Trans. Graph. 2014, 33, 1–10. [Google Scholar] [CrossRef]
  13. Nie, Y.; Hou, J.; Han, X.; Niener, M. RfD-Net: Point Scene Understanding by Semantic Instance Reconstruction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Virtual, 19–25 June 2021. [Google Scholar]
  14. Steinbrücker, F.; Sturm, J.; Cremers, D. Real-time visual odometry from dense RGB-D images. In Proceedings of the IEEE International Conference on Computer Vision Workshops, Barcelona, Spain, 6–13 November 2011. [Google Scholar]
  15. Park, J.; Zhou, Q.; Koltun, V. Colored pointcloud registration revisited. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017. [Google Scholar]
  16. Tu, S.; Dong, L.; Yang, H.; Huang, Y. Complex variable moving Kriging interpolation for boundary meshless method. Eng. Anal. Bound. Elem. 2016, 65, 72–78. [Google Scholar] [CrossRef]
  17. Quinsat, Y. Filling holes in digitized pointcloud using a morphing-based approach to preserve volume characteristics. Int. J. Adv. Manuf. Technol. 2015, 81, 411–421. [Google Scholar] [CrossRef]
  18. Centin, M.; Pezzotti, N.; Signoroni, A. Poisson-driven seamless completion of triangular meshes. Comput. Aided Geom. Des. 2015, 35, 42–55. [Google Scholar] [CrossRef]
  19. Li, S.; Yao, Y.; Tian, F.; Long, Q. Reconstructing Thin Structures of Manifold Surfaces by Integrating Spatial Curves. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018. [Google Scholar]
  20. Yuan, W.; Khot, T.; Held, D.; Mertz, C.; Hebert, M. PCN: Point completion network. In Proceedings of the 2018 International Conference on 3D Vision, Verona, Italy, 5–8 September 2018; pp. 728–737. [Google Scholar]
  21. Huang, Z.; Yu, Y.; Xu, J.; Ni, F.; Le, X. PF-Net: Point fractal network for 3d pointcloud completion. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Virtual, 14–19 June 2020. [Google Scholar]
  22. Qi, C.R.; Su, H.; Mo, K.; Guibas, L.J. PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Hawaii, HI, USA, 21–26 July 2017. [Google Scholar]
  23. Qi, C.R.; Yi, L.; Su, H.; Guibas, L.J. PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space. arXiv 2017, arXiv:1706.02413. [Google Scholar]
  24. Zhang, Y.; Funkhouser, T. Deep depth completion of a single rgb-d image. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018. [Google Scholar]
  25. Jeon, J.; Lee, S. Reconstruction-based pairwise depth dataset for depth image enhancement using CNN. In Proceedings of the European Conference on Computer Vision, Munich, Germany, 8–14 September 2018. [Google Scholar]
  26. Xiao, J.; Ying, W. A Semi-fragile Watermarking Tolerant of Laplacian Sharpening. In Proceedings of the IEEE International Conference on Computer Science & Software Engineering, Wuhan, China, 12–14 December 2008. [Google Scholar]
  27. Roosmalen, V. Restoration of Archived Film and Video. Ph.D. Thesis, Delft University of Technology, Delft, The Netherlands, 1999. [Google Scholar]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.