Project 4: Scene Completion
cs195-g: Computational Photography Patrick Doran
Spring 2010 pdoran
Directory
Algorithm: Scene Completion Using Multiple Patches
High level description of the algorithm.
1 While there are still unfilled pixels, do
2 Identify the border of the unfilled region
3 Compute the fill priority using a confidence term and data term. The confidence term C is the sum of the confidence of filled pixels divided by the number of pixels in that patch. The data term data term comes from the isophote of that pixel (image gradient) dotted with the normal of the known pixels as that pixel. Multiplying this with the confidence term boosts the priority of pixels with strong linear information (ie, edges).
4 Find the patch with maximum priority.
5 By template matching, find the best patch that minimizes the sum of squared differences.
6 Select the patch and composite it into the image using GraphCut to improve seams on the patch.
7 Update the confidence term of those pixels just filled with the confidence of the original pixel.
General Comments

This algorithm works well on the ideal cases as well as many actual photos. Instead of doing onion peel order (just the confidence term mentioned above), the heuristic of propagating edge information works quite well. It works best filling small holes that have very strong edges into the hole.

Priority is calcuated from a confidence and a data term. The confidence term is based on the confidence of surrounding pixels. In the case of the initial contour of the mask, it is the number of already known pixels. As the algorithm continues, confidence is calculated from the confidence of newly filled surrounding pixels. An onion peel order would calculate the confidence every time, filling in the patches centered at pixels surrounded by the most known pixels.

An improvement to that is to propagate confidence values. If we are confident in our choice for a pixel, then we are just as confident in our choice for pixels in the newly filled region.

The confidence term does not take into consideration structural information from the image. This necessitates a data term. From the Object Removal by Exemplar-based Inpainting, the suggested data term is an isophote dotted with the normal of the pixel; this measures the strength of a linear structure as it hits the contour of the hole. An isophote is essentially the gradient rotated by 90 degrees and it represents the strength of flow of an edge.

By normalizing both the confidence and gradient, both can be used without squashing the other metric and produce a more reasonable order to inpainting.

Usually, taking larger patches worked better than smaller patches. But by taking larger patches, less of the image becomes available to use as the algorithm is forced to choose patches far enough from the hole in the image. Unfortunately it is up to the user to determine the appropriate size.

Results
Source Hole Result Movie

Mask

Movie File

Mask

Movie File

Mask

Movie File

Mask

Movie File

Mask

Movie File

Mask

Movie File

Mask