A couple years ago, when Reuters photographer Adnan Hajj got in trouble for some really bad Photoshopping, I fantasized about adapting Evolution Robotics' object recognition technology and using it to automatically screen news photos for suspicious alterations.
It turns out you don't need something as advanced as VIPR to detect simple cloning/stamping. John Graham-Cumming recently posted code to detect “copy-move forgery,” based on a paper by Jessica Fridrich, David Soukal and Jan Lukáš.
Copymove.zip contains Graham-Cumming's code, with a few modifications: I implemented the (big) speedup mentioned in this comment, and I changed it so the code only outputs the single final image containing all copied blocks, instead of multiple output images.
The algorithm is pretty good at detecting the alterations in Adnan Hajj's photos. On the left are Hajj's altered photos. On the right are the results of running the images through copymove.c, with red and blue squares showing the cloned sections.
The plume of smoke on the left side of the above photo was pretty obviously cloned, and caught by copymove. The plume on the right has some cloning too, and supposedly some buildings have been cloned.
The jet in this photo dropped one flare, and Hajj copied it to create two more. The bands on the top and bottom might be an artifact of the image, or its processing, or the copymove algorithm.
The image below is from a 2004 campaign ad for George Bush. “President Bush's campaign acknowledged Thursday that it had doctored a photograph used in a television commercial and said the ad will be re-edited and reshipped to TV stations.”
Copymove seems to have correctly identified the clones in the crowd.
What about this magical hovering woodchuck?
Looks like another assault on photojournalistic integrity by someone with a stubby-little-legs-remover tool.
Unfortunately copymove isn't quite ready to be run on every AP and Reuters photo. The program takes two parameters, a “quality” (blurring) factor and a threshold. I used a quality of 10 and threshold of 20 for most of the images above, but those values don't work for all images. Some images (especially anything with a blurry background) are filled with false positives no matter what settings are used. And finally, I couldn't find an RSS or atom feed containing high quality news photos. (are there any?)
Later: I accidentally uploaded an old version of the code. I've updated the zip file with the right version.
Posted by jjwiseman at February 26, 2008 03:43 PMI have access to apimages.ap.org from campus, and while they don't have an RSS feed, they do have a stream of all news photos from the Associated Press wire. The terms of service explicitly preclude and crawling or scraping, but depending on how serious you are about this, I'm sure they'd be happy to sell you a data feed.
Posted by: Andrew on February 26, 2008 05:46 PMFor what it's worth, Dave Winer's FlickrFan uses photo feeds from AP.
Posted by: Ehud on February 26, 2008 06:08 PMVery cool! Can you run it on the image in this story about the Chinese antelope?
Posted by: Michael H. on February 26, 2008 06:46 PMMike, here it is with quality 5, threshold 30:
http://lemonodor.com/images/chinese-antelope.jpg
The copy-move detection algorithm doesn't really work for the splicing together of elements from different images. I ran a bunch of photoshop contest entries through it and they just don't typically use a lot of cloning.
Posted by: John Wiseman on February 26, 2008 08:44 PMEhud, I actually played with FlickrFan a bit hoping to use its feeds. I think it might have used an AP feed at one time but I only saw a feed from a French news agency. I did experiment with that a bit, but FlickrFan is kind of ugly, and it seems to have been designed to make it difficult to figure out the feed URLS[1].
[1] http://eyeonwiner.org/archives/2008/is-flickrfans-ap-feed-proprietary-rss
Posted by: John Wiseman on February 26, 2008 08:50 PMGreat post, great blog!
Posted by: machinehuman on February 26, 2008 09:33 PMGreat post. I'm glad that my code proved useful and I love to see these results.
Posted by: John Graham-Cumming on February 26, 2008 10:37 PMI guessed that is the case... It's a shame though.
Posted by: Ehud on February 26, 2008 10:46 PMAww, no evidence of copied antelope? That's a shame.
Posted by: Michael H. on February 27, 2008 03:26 PM
"Whatever it takes". ........
Of course, this all-inclusive slogan also includes the violation of U.S. federal criminal statutes.
Posted by: K. Fligmore on February 28, 2008 12:35 PMIs there a Windows version of this code I can run?
Posted by: Lisp Idiot on March 25, 2008 07:05 AM@Lisp Idiot: I downloaded John's file, and it's just pure C, and the Makefile looks like it should be easy to translate to Visual C++. Looking at this Free Image library he references, that's Windows, Linux, and MacOSX.
Posted by: Michael H. on March 27, 2008 07:19 PMGreat ,Really Great
Posted by: YuHao on April 2, 2008 07:02 AMGreat work! I'll give it a try later. It's midnight here. :)
Posted by: Kit on April 4, 2008 09:31 AMWow
Posted by: Dave Q on April 6, 2008 03:45 PMTry it on all those holocaust pictures.
Posted by: puttputt on April 14, 2008 05:05 PMI gave it a try, that is pretty cool. Sometimes it's hard to get quality/threshold right. The version now outputs multiple images, as well as the final. Do you have the version that only outputs final?
Posted by: anthony on April 16, 2008 12:33 PM@puttputt:
Don't worry...Those holocaust pictures were doctored BEFORE photoshop...So we'll never find out how many MORE people were really in those photos...
You've managed to say the stupidest thing I've ever heard on any blog...That's truly amazing.
Posted by: Adolf on April 19, 2008 08:19 AMAnthony, if you just comment out lines 490->493 in copymove.c, only the final image is created
Posted by: Cambell on April 22, 2008 03:20 PMAnthony, if you just comment out lines 490->493 in copymove.c, only the final image is created
Posted by: Cambell on April 22, 2008 03:22 PMdude, put in a captcha instead of making people type list - it's bad UI technique (and it's still easily programatically fuck-with-able. Anyway - the holocaust remark really is the dumbest thing I've ever read; what did he even mean? Great software, btw.
Posted by: sikanrong on April 23, 2008 03:00 PMgreat article
Posted by: Panda Bears on April 30, 2008 07:36 AMPhotoshop changed our lives
Posted by: sexy gamer on April 30, 2008 08:23 AM