The basic technique is to scale down images and treat them as high dimensional points, then match them with patches of the main image, also treated as high dimensional points. This can be done efficiently with high dimensional nearest neighbors.
You might be thinking of SIFT, which was a patented and part of the methodology was more efficient high dimensional searching using best bin first kd-trees.
How can a developer protect themselves from publishing patented software? Is there any way of knowing if a certain type of program is patented?
If you've a seen similar thing pre-existing, chances are that it may be someone's intellectual property, and which then should be respected.
In this particular example, Wikipedia page on photographic mosaics [1] itself has a section on IP aspects of the same [2].
>> How can a developer protect themselves from publishing patented software?
The best approach is to respect the prior art and properly license the same as needed.
At times, a developer may have strong reasons to believe that the related prior patents are either not infringed or are invalid. In this case they should be ready to be challenged.
[1] https://en.wikipedia.org/wiki/Photographic_mosaic
[2] https://en.wikipedia.org/wiki/Photographic_mosaic#Trademark_...