python implementation of re-sampling algorithm #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit implements probability maps and fourier maps for detecting traces of resampling as explained in the paper:
"Exposing Digital Forgeries by Detecting Traces of Re-sampling" by Hany Farid & Alin C. Popescu
The book "Photo Forensics" by Hany Farid gives a more detailed explanation of the technique for those interested
The interface is pretty user friendly, but could be improved upon.
Brief explanation on how the tool might be used for analysis:
Upon opening the resampling tool, the image is displayed in grayscale. (re-sampling analysis must be done in grayscale in order to avoid CFA artifacts.)
left click on the image to select regions of interest to calculate the probability map; right click to remove last point.
if no region of interest is selected, the probability maps for the entire image is calculated when clicking the corresponding button.
In order to calculate fourier maps for a given area, switch the checkbox to "fourier Windows"
Analysis of fourier maps to verify periodic artifacts can be difficult, because JPEG compression artifacts are already visible at 98-99% quality and these periodic artifacts influence the visibility of other interpolation artifacts that might have been introduced through re-sizing,...
Further more, depending on the camera, an original picture at 0% compression might already have some type of periodic artifact.
To successfully use re-sampling for forensic analysis, it is advisable to compare fourier maps from different regions to the "general" fourier map of the entire picture.
local areas that were part of the original picture, should display a similar fourier map; where as manipulated regions might have a distinct fourier map and thus indicative of tampering/not being part of the original capture.
The probability map can also aide analysis, as similar regions should have a similar probability of being interpolated, when this is not the case, one region might be manipulated.
Different parameters to construct the fourier map have a huge impact on how periodic patterns might be perceived. Only compare fourier maps that have equal settings!
Uniform areas and different manipulations (compression, re-size, rotate,..) will disturb each others' periodic signals and make analysis more difficult.