EDS 6364 Digital Image Processing · Smit Patel

Is this photo real?
Classical DIP evidence, honestly evaluated.

Eight interpretable techniques (ELA, histograms, noise, JPEG ghosts, DCT, edges and two copy-move matchers) detect and localise copy-move and splicing forgeries. The evaluation on CASIA v2.0 controls for a label leak that makes the dataset, as released, solvable without looking at the pixels.

Finding 1 · the dataset

The files give the answer away

0.990

balanced accuracy from file metadata alone on CASIA v2.0 as released (AUC 0.999). Most tampered images are TIFF files; authentic images are JPEGs, 89 % of them with standard IJG tables that no tampered JPEG uses.

ProtocolAll shortcuts
A · files as released0.989
C · JPEG files only0.986
B · re-encoded as JPEG Q850.797
R · downscaled ×0.75, then re-encoded (main)0.649

Balanced accuracy of classifiers that see only global cues (metadata, size, compression statistics). A forensic feature counts only if it beats these under the same protocol.

Bar chart: balanced accuracy of shortcut features under protocols A, C, B and R
outputs/10_leakage_shortcuts.png
The pipeline, in order

Five course topics, eight techniques

Every step on one validation copy-move image (the pasted person on the right is a mirrored copy of the one on the left), after protocol R. Each module compares a region with the rest of its own image.

0 · input

Protocol R and ground truth

The image is downscaled ×0.75 and re-saved as JPEG Q85 before any analysis, which erases file-format and compression-history shortcuts.

Original image
00 as released
Ground-truth region
01b ground truth (green)
1 · point processing

Error level analysis

|I − JPEGq(I)| per pixel: a region with a different compression history re-compresses differently. Divided by block texture so busy areas are not mistaken for tampering.

ELA residual
02a ELA residual ×10
Texture-normalised ELA
02b texture-normalised
2 · histogram processing

Equalisation and χ² patch histograms

The low-contrast ELA residual is histogram-equalised; each patch's histogram is compared with the image's typical one.

Equalised ELA
03a equalised ELA
Histograms before and after equalisation
03b before / after
3 · spatial filtering

Local noise level

A high-pass kernel leaves only sensor noise; its robust σ is estimated per block over non-edge pixels. A region from another camera often carries different noise.

Noise residual
04a high-pass residual
Noise sigma map
04b log σ per block
4 · frequency domain

DCT double quantisation and JPEG ghosts

JPEG quantises 8×8 DCT coefficients, so their histogram spikes at multiples of the step; double compression leaves a periodic pattern that pasted regions lack. JPEG ghosts re-save at many qualities and look for regions that disagree.

DCT coefficient histogram
05a DCT histogram
JPEG ghost map
05c JPEG ghost
5 · edge & corner detection

Canny sharpness and SIFT copy-move

Canny edges measure boundary sharpness. SIFT keypoints are matched against the image itself and its mirror, then verified with RANSAC — here it finds both the source and the flipped copy (14 inliers).

Canny edges
06a Canny edges
Copy-move keypoint evidence
06c keypoint copy-move
6 · detection

Fusion, verdict and region

A calibrated random forest fuses 82 features into P(tampered) and abstains inside an uncertain band; gradient boosting fuses the eight maps into a mask. Verdict here: tampered (P = 0.99), likely copy-move.

Fused tampering probability
07a fused probability
Detected region overlay
07b suspected region
Every number, read from the run

Test set, evaluated once

1,892 held-out images, frozen by hash before any model was trained, evaluated once; every later use is logged. Protocol R unless stated.

0.805
test AUC, 95 % CI [0.779, 0.831], against 0.712 for the shortcuts
+0.103
added over the shortcut features, CI [0.076, 0.129]
86 %
accuracy on the 52 % of images the calibrated detector judges
0.972
AUC on MICC-F220, an unseen copy-move dataset (11 forged scenes)
At threshold 0.5RB
Accuracy0.7490.850
Precision0.7560.813
Recall0.5670.819
F10.6480.816
Localisation pixel F10.1980.308
Deployed detector (R)authentictampereduncertain
truly authentic (1,123)61913491
truly tampered (769)126222421

Robust to re-saving: AUC ≥ 0.78 down to JPEG quality 50; a social-media-style upload costs 0.04. Main weaknesses: same-history splices, low-detail images, self-similar scenes (all 13 false alarms had copy-move matches).

Test ROC curves under protocol R
outputs/15_test_roc.png
Finding 2 · deep learning

An ELA-CNN scores highest only on the leaking files

A pretrained ResNet-18 on ELA images, same splits and protocols, pre-registered and evaluated once.

Test AUCELA-CNNClassical
A · files as released0.9940.981
B · re-encoded0.8110.920
R · strict0.7700.805
MICC-F220 (R)0.5290.972

On the released files the shortcut features alone reach 1.000. Under R the CNN trails by 0.036 [0.005, 0.067] and is not significantly better than a shortcut SVM; on MICC-F220 its AUC is consistent with chance.

ELA of an authentic JPEG and a tampered TIFF, as released and after protocol R
ELA as released: the authentic JPEG is almost black, the tampered TIFF lights up
Validation, including what went wrong

Mistakes caught before the test set was touched

209 automated tests cover the modules on synthetic forgeries with known regions, the protocols, the split invariants, the statistics and the interface.

Run it

From a fresh clone

git clone https://github.com/Smit2102/image-forgery-detection.git
cd image-forgery-detection
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
# place CASIA v2.0 at CASIA2/, then run the pipeline scripts in order (see README)
.venv/bin/python detect.py photo.jpg          # one image -> verdict, mask, overlay, report.json
.venv/bin/streamlit run app/Home.py           # interactive tool at http://localhost:8510
The whole pipeline on one image
outputs/08_summary_grid.png — the whole pipeline on one image