forgery-detection-zero

Crates.ioforgery-detection-zero
lib.rsforgery-detection-zero
version0.3.0
sourcesrc
created_at2022-11-17 21:51:19.649338
updated_at2022-12-11 17:25:13.100831
descriptionJPEG grid detector applied to forgery detection in digital images
homepage
repositoryhttps://github.com/ronnychevalier/forgery-detection-zero
max_upload_size
id717507
size92,567
Ronny Chevalier (ronnychevalier)

documentation

https://docs.rs/forgery-detection-zero/

README

forgery-detection-zero

An implementation of ZERO: a JPEG grid detector applied to forgery detection in digital images.

The approach is described in the following paper:

Tina Nikoukhah, Jérémy Anger, Miguel Colom, Jean-Michel Morel, and Rafael Grompone von Gioi,
ZERO: a Local JPEG Grid Origin Detector Based on the Number of DCT Zeros and its Applications in Image Forensics,
Image Processing On Line, 11 (2021), pp. 396–433. https://doi.org/10.5201/ipol.2021.390

The original implementation is written in C.

Library example

Simple usage:

# use forgery_detection_zero::Zero;
# let jpeg = todo!();
#
for r in Zero::from_image(&jpeg).into_iter() {
    println!(
        "Forged region detected: from ({}, {}) to ({}, {})",
        r.start.0, r.start.1, r.end.0, r.end.1,
    )
}

More advanced usage:

# use forgery_detection_zero::Zero;
# let jpeg = todo!();
#
let foreign_grid_areas = Zero::from_image(&jpeg).detect_forgeries();
let missing_grid_areas = foreign_grid_areas
    .detect_missing_grid_areas()
    .unwrap()
    .unwrap();
let forged_regions = foreign_grid_areas
    .forged_regions()
    .iter()
    .chain(missing_grid_areas.forged_regions());
for r in forged_regions {
    println!(
        "Forged region detected: from ({}, {}) to ({}, {})",
        r.start.0, r.start.1, r.end.0, r.end.1,
    )
}

CLI example

You can use the example to generate the forgery masks of an image:

cargo r --release --example zero image.jpg
Commit count: 52

cargo fmt