Copy-move image forgery detection library.
MIT License
Forensic is an image processing library which aims to detect copy-move forgeries in digital images. The implementation is mainly based on this paper: https://arxiv.org/pdf/1308.5661.pdf
RGB
image to YUV
color space.R
,G
,B
,Y
components into fixed-sized blocks.R
,G
,B
and Y
components.R
,G
,B
and Y
components DCT
(Discrete Cosine Transform) coefficients.DCT
coefficients and save it into a matrix. The matrix rows will contain the blocks top-left coordinate position plus the DCT coefficient. The matrix will have (M − b + 1)(N − b + 1)x9
elements.First install Go if you don't have already installed, set your GOPATH
, and make sure $GOPATH/bin
is in your PATH
environment variable.
$ export GOPATH="$HOME/go"
$ export PATH="$PATH:$GOPATH/bin"
Next download the project and build the binary file.
$ go get -u -f github.com/esimov/forensic
$ go install
In case you do not want to build the binary file yourself you can obtain the prebuilt one from the releases folder.
$ forensic -in input.jpg -out output.jpg
$ forensic --help
Image forgery detection library.
Version:
-blur int
Blur radius (default 1)
-bs int
Block size (default 4)
-dt float
Distance threshold (default 0.4)
-ft float
Forgery threshold (default 210)
-in string
Input image
-ot int
Offset threshold (default 72)
-out string
Output image
Original image | Forged image | Detection result |
---|---|---|
Sometimes the library produces false positive results depending on the image content. For this reason I advise to adjust the settings. Also in some cases human judgement is required, but otherwise the library do a decent job in detecting forged images.
The more intensive the overlayed color is, the more certain is that the image is tampered.
Copyright © 2018 Endre Simo
This project is under the MIT License. See the LICENSE file for the full license text.