File size: 2,613 Bytes
e2472ac
 
 
 
 
 
 
 
 
 
 
fc8df74
 
40598e4
fc8df74
40598e4
fc8df74
df74620
 
fc8df74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40598e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fc8df74
40598e4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: Digital Image Forensics Toolkit
emoji: 🕵️‍♂️
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: "5.49.1"
app_file: app.py
pinned: false
---

# Digital Image Forensics Toolkit 🕵️‍♂️

This repository provides a collection of fundamental digital forensic algorithms designed to detect "cheap fakes"—image manipulations created with standard editing software like Photoshop or GIMP. The tools are implemented in Python and deployed on a local server using a [Gradio](https://www.gradio.app/) web interface.

These methods are effective for identifying traditional forgeries such as splicing, copy-move, and inconsistent lighting.

---

## Forensic Tools

This toolkit includes the following analysis methods:

### 🎨 Color Filter Array Analysis (`CFA.py`)
Analyzes artifacts introduced during the camera's raw image processing. Inconsistencies in the **Color Filter Array (CFA)** interpolation pattern can reveal areas that have been spliced from another image or copy-pasted within the same image (copy-move).

### 👻 JPEG Ghost Detection (`JPEG_Ghost.py`)
Detects forgeries by identifying regions within an image that were compressed with different **JPEG Quality Factors (QF)**. When an area from a different JPEG image is spliced in, it often carries the "ghost" of its original compression level, which this tool can reveal.

### 📸 PRNU Analysis (`PRNU.py`)
Uses the **Photo Response Non-Uniformity (PRNU)** pattern, a unique noise fingerprint inherent to every digital camera sensor. By comparing the PRNU of an image against a camera's known fingerprint, this tool can identify tampered regions (splicing, copy-move) that do not share the same origin. While typically used for source camera identification, local correlation analysis makes it a powerful forgery detector.

### ☀️ Shadow Consistency Analysis (`shadows.py`)
A utility for verifying geometric consistency of shadows in an image. By projecting vanishing points, it helps determine if all shadows correspond to a single, coherent light source. This method is based on principles of perspective and can be useful for analyzing both traditional manipulations and AI-generated images.

---

## ⚙️ Getting Started

### Prerequisites
* Python 3.10+
* pip

### Installation

    pip install -r requirements.txt
    
### Run locally

    python app.py

---

## 🚀 Deploying to Hugging Face Spaces

This repo is ready for a Gradio Space.

- Set the Space SDK to: Gradio
- Set the entry point to: `app.py`
- Hardware: CPU is sufficient

The `requirements.txt` already includes all dependencies.

---