Alternatively, the paper also describes a method of coherence matching, inspired by Ashikhmin's prior paper. Coherence matching uses the already synthesized portion of B' adjacent to q in order to make a better estimate, based on where those nearby synthesized portions came from. The paper uses both of these matching methods and uses the luminance features to describe an error, which determines which returned point to use.
ANN was very slow in my implementation - blkproc was not as successful as I would have hoped. Additionally, depending on the size of the neighborhood, results can be noisy (tried running it pixel by pixel vs. 5x5 pixel blocks). This search is also very susceptible to the type of training data given. Despite trying to match up the images A' and B colorwise, the RGB colorspace is too vast and the sampling usually too small.
I probably should have used something object oriented - would have been much simpler in some respects (C++?). Coherence matching and comparison against the approximate match would have made the results a lot better, I think, because it would have improved perceptual distances, even though the matches would be less similar in the L2 norm.
Results in this image are very noisy because of a lack of coherence, but it is possible to see the general shape of B in B'. The was done by matching ANN, and the second set was done by matching pixels. The ANN search is a little more coherent, but still not very good.
Identity - can recreate itself.