Scene completion by searching over a large image database has two basic components
 |
 |
 |
Target Image |
Patch |
Convolution Mask |
Once the optimal patch is found the corresponding graph cut needs to be computed.
To find the optimal seam I minimize the SSD between the source and target images along with a distance penalty (k*distance(p,hole))^3, as suggested in the paper. The distance penalty encourages cuts closer to the hole.
Results
Here are some of the cases where the algorithm works reasonably well. All the results shown are without any blending.
And here are some spectacular failures. A large number of errors are because I compare average patch statistics and not the SSD between patches. Firstly, by comparing just the patch mean I end up throwing away all spatial relationships which is a bad idea. Secondly, whenever the patch contains a variety of colors, the average color of the patch isn't a very relaible statistic of the patch and as a result the matches are not very good. In city scenes, with lots of small objects of various colors this effect is particularly visible.
Multiple completions can be generated by finding many close patches instead of just one. These matches are sorted on the basis of their similarity to the reference patch. Here is an example where 5 completions were generated. The completions are presented in decreasing order of their similarity with the reference patch.
Auto Colorization
For extra credit, I tried out the auto colorization scheme suggested by Torralba et al. Here are the results: