Skip to main content

Library for detecting image copy-move attack

Project description

This is a python package for detecting copy-move attack on a digital image.

More documentation is detailed on the Github page.

Example usage

API for the detection process

from pimage import copy_move

fraud_list, ground_truth_image, result_image = copy_move.detect("dataset_example_blur.png", block_size=32)
  • fraud_list will be the list of (x_coordinate, y_coordinate) and the number of the blocks. If the list is not empty, we can assume that the image is being tampered. For example:
    ((-57, -123), 2178)
    ((-11, 140), 2178)
    ((-280, 114), 2178)
    ((-34, -305), 2178)
    ((-37, 148), 2178)
    
    means there are 5 possible matched/identical region with 2178 overlapping blocks on each of it
  • ground_truth_image contains the black and white ground truth of the detection result
  • result_image is the given image where the possible fraud region will be bordered (if any)

ground_truth_image and result_image will be formatted as numpy.ndarray. It can further be processed. For example, it can be exported as image like so:

import imageio

imageio.imwrite("result_image.png", result_image)
imageio.imwrite("ground_truth_image.png", ground_truth_image)

Quick command to detect an image

To quickly run the detection command for your image, the copy_move.detect_and_export() is also provided. The command is identical with .detect() but it also save the result to desired output path.

from pimage import copy_move

copy_move.detect_and_export('dataset_example_blur.png', 'output', block_size=32)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pimage-1.0.6.tar.gz (22.6 kB view hashes)

Uploaded Source

Built Distribution

pimage-1.0.6-py3-none-any.whl (20.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page