

Ask HN: How could this forgery detection script be optimized? - callmeed

So, I was reading about this doctored photo in the NYT Magazine:<p>http://minnesota.publicradio.org/collections/special/columns/news_cut/archive/2009/07/fakery_in_the_times.shtml<p>And I recalled seeing this blog post and python script a while back:<p>http://code.google.com/p/coding-experiments/source/browse/trunk/Python/detect_copymove.py<p>I grabbed the script and image in question from the NYT. I ran the script, and sure enough, several blocks of pixels came back as being copied.<p>Problem was–the script took almost 5 minutes to analyze the image.<p>Just curious if it could be optimized or, better yet, easily rewritten in C to be much faster.
======
gorramit
As the author says, the script is rather adhoc.

The script errors out for me, but from the comments, the basic procedure is to
break up a low-resolution version of the image into blocks, and then cluster
these blocks on some criterion.

Let me see if I can cook up something for you after work :) The simplest
speedup I can see is to memoize the distance function calls.

