• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Copy-move image forgery detection library.

Forensic

build 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

Implementation details

  • Convert the RGB image to YUV color space.
  • Divide the R,G,B,Y components into fixed-sized blocks.
  • Obtain each block R,G,B and Y components.
  • Calculate each block R,G,B and Y components DCT (Discrete Cosine Transform) coefficients.
  • Extract features from the obtained 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.
  • Sort the features in lexicographic order.
  • Search for similar pairs of blocks. Because identical blocks are most probably neighbors, after ordering them in lexicographic order we need to apply a specific threshold to filter out the false positive detections. If the distance between two neighboring blocks is smaller than a predefined threshold the blocks are considered as a pair of candidate for the forgery.
  • For each pair of candidate compute the cumulative number of shift vectors (how many times the same block is detected). If that number is greater than a predefined threshold the corresponding regions are considered forged.

Install

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.

Usage

$ forensic -in input.jpg -out output.jpg

Supported commands:

$ 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

Results

Original image Forged image Detection result
dogs_original dogs_forged dogs_result

Notice

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.

How to interpret the results?

The more intensive the overlayed color is, the more certain is that the image is tampered.

Author

License

Copyright © 2018 Endre Simo

This project is under the MIT License. See the LICENSE file for the full license text.

More Repositories

1

caire

Content aware image resize library
Go
10,356
star
2

pigo

Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.
Go
4,386
star
3

triangle

Convert images to computer generated art using delaunay triangulation.
Go
2,038
star
4

diagram

CLI app to convert ASCII arts into hand drawn diagrams.
Go
835
star
5

stackblur-go

A fast, almost Gaussian Blur implementation in Go
Go
256
star
6

dithergo

Various dithering algorithms implemented in Go
Go
167
star
7

gobrot

Mandelbrot image renderer in Go
Go
105
star
8

gogu

A comprehensive, reusable and efficient concurrent-safe generics utility functions and data structures library.
Go
97
star
9

colorquant

Go library for color quantization and dithering
Go
85
star
10

legoizer

A tool to convert images to Lego bricks.
Go
80
star
11

ascii-fluid

Terminal based ASCII fluid simulation controlled by your webcam. 🌊
Go
66
star
12

colidr

Coherent Line Drawing implementation in Go.
Go
55
star
13

pigo-wasm-demos

Webassembly demos showcasing the Pigo face detection library.
Go
53
star
14

gifter

Gif image renderer running in terminal.
Go
44
star
15

gospline

Implementing b-spline curves in Go
Go
37
star
16

cloth-physics

Desktop application for cloth physics simulation using Gio GUI.
Go
37
star
17

triangle-app

Desktop application for Triangle.
JavaScript
35
star
18

pigo-face-tracking

Play games with your head. A face tracking application using the Pigo library.
Go
27
star
19

asciibrot

ASCII mandelbrot fractal running in terminal
Go
22
star
20

facemask

Overlay a mask over a person's face
Go
17
star
21

pigo-openfaas-faceblur

OpenFaaS faceblur function using the Pigo face detector library. (https://github.com/esimov/pigo)
Go
17
star
22

minecraft.js

Simplex noise based minecraft map generator
JavaScript
17
star
23

caire-openfaas

OpenFaaS function for Caire, the content aware image resize library. (https://github.com/esimov/caire)
Go
13
star
24

pigo-openfaas

OpenFaaS function for face detection using the Pigo library. (https://github.com/esimov/pigo)
Go
12
star
25

openfaas-coherent-line-drawing

Coherent Line Drawing OpenFaaS function based on https://github.com/esimov/colidr
Go
11
star
26

gomp

Alpha compositing operations and blending modes in Go.
Go
10
star
27

pigo-gocv-benchmark

Pigo vs GoCV face detection benchmark comparison
Go
4
star
28

simplexnoise.js

Javascript simplex noise implementation based on Stefan Gustavson paper: http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
JavaScript
3
star
29

homebrew-triangle

Brew formula for Triangle.
Ruby
2
star
30

go-arena

Testing and benchmarking the new experimental Go memory arenas.
Go
2
star
31

talks

Talks I have given
TeX
1
star
32

flash-experiments

Old Flash (ActionScript3) experiments
ActionScript
1
star