# Detecting copy-move forgery in images

GROUPS:
 olivier k 2 Votes Mathematica 9 offers new image processing capabilities.There some quite interesting example on Matlab to detect copy-move forgery in images. I was wondering if any one had some ideas to implement such a functionality based on Mathematica 9 ?As good basis to start with some information and Matlab code :A SIFT-based forensic method for copy-move detectionKind regards, Olivier
5 years ago
8 Replies
 Sean Clarke 1 Vote There's a lot to read there. To implement this, you will want to break your problem up into the same parts that the video shows. The first half appears to be some cluster analysis to identify parts of the image that are likely candidates for copied parts. Can you tell us more about how they implement this and what methods they use?The second half is more straightforward and there are built in functions for it. This part involves finding the corresponding points of the matched parts and finding the geometric transfomation that relates them. To do this use ImageCorrespondingPoints and then pass the corresponding points to FindGeometricTransform .
5 years ago
 Jari Kirma 3 Votes It might be worth mentioning that ImageKeypoints provided by Mathematica uses a SURF ( http://en.wikipedia.org/wiki/SURF ) detector to find keypoints. SURF is development partially based on SIFT, which authors of the referred paper have obviously used. ImageCorrespondingPoints and ImageFeatureTrack use SURF data from ImageKeypoints to do their job.
5 years ago
 Matthias Odisio 1 Vote Jari,It is true that ImageKeypoints uses SURF, but ImageFeatureTrack does not. Conceptually, ImageFeatureTrack uses corners.Matthias
4 years ago
 Marco Thiel 4 Votes Dear all,the following two-liner is based on the fact that the different parts of a fake image might have different compression rates in certain image formats, such as jpg etc. Loss-less formats do not work for this. We start with a fake jpg-image downloaded from the internet:First I import the image from the desktop:img1 = Import["~/Desktop/Fake.jpg"]Then I export it with a low compression rate:Export["~/Desktop/img1comp.jpg", img1, "CompressionLevel" -> 0.012]I then import the new imageimg2 = Import["~/Desktop/img1comp.jpg"];and then substract the images and adjust the colour range.ImageSubtract[img1, img2] // ImageAdjust In the resulting image the forged parts are supposed to light up. Here only slightly; it will work better once the compression rate is adapted.This illustrates just the general idea. There is an "aura" of brighter pixels around the object that is copied in. Everything can be joined up into a (kind of) one-liner. I then wrap a little manipulate command around it, to vary the compression rate. In order to make this work one needs to play a bit with the compression rates, i.e. move the slider.Manipulate[ Export["~/Desktop/img1comp.jpg", img1, "CompressionLevel" -> comp]; img2 = Import["~/Desktop/img1comp.jpg"]; ImageSubtract[img1, img2] // ImageAdjust, {{comp, 0.05}, 0, 0.5}]Summary: (i) this is only a very crude algorithm, but it works in some cases, (ii) Mathematica certainly has all the algorithms to detect forgery in images, (iii) the shark in the image appears to be copied in :-)A nice game is to write a little web-crawler to download images from common social network sites and analyse how many of them are fake. Note, that this particular algorithm is not particularly useful to detect forgeries of photos on facebook or dating websites, because they are often not "copy-and-paste", but rather "increase or decrease" the size of certain parts of an image. Here is another example:The output of the program is:It is important to note that this method is not at all fool-proof; often there are false positives.
4 years ago
 Sam Carrettie 1 Vote Marco, this is such a simple but neat trick! I tried (naively) a bit different approach with resizing image, but that seems to pickup on sharper edges only, I think:img = Import["http://community.wolfram.com/c/portal/getImageAttachment?filename=Unknown.jpeg&userId=48754"];id = ImageDimensions[img];ImageSubtract[#, ImageResize[ImageResize[#, id/5], id]] &@img