You are on page 1of 19

SUPERIOR UNIVERSITY LAHORE

PROJECT REPORT
(DIGITAL IMAGE PROCESSING)

[Image Forgery Detection]

Project Team
Student Name Student ID
Wasiq Khawar BCSM-F16-363
Anas Abbas BCSM-F16-422
Hassnain Jan BCSM-F16-200

[Miss Maryum Zahoor]


Project Report: < Image Forgery Detection>
Image Forgery Detection:
The detection of image manipulation is very important because an image can be used as legal evidence,
in forensics investigations, and in many other fields. The pixel-based image forgery detection aims to
verify the authenticity of digital images without any prior knowledge of the original image.

Types of forgery Detection


 Image Retouching
 Image Splicing( copy paste)
 Image cloning (copy move)

These are the types of forgery Detection and we select Image cloning (copy Move and Copy {Paste).

Clone Detection

Copy-paste and move cloning forgeries can be very difficult to spot, in many cases
appearing to look the same as legitimate areas. Cloning is therefore a popular forgery
method as duplicating existing areas of an image tends to produce much more believable
results than splicing an image from else.where Copy-paste cloning detection algorithms
operate by scanning the image for regions of matching, identical pixels. By its nature, this
type of algorithm will only detect cloning forgeries, it is not a general use algorithm and will
therefore not detect other types of forgeries.
ABSTRACT:
we propose the Forgery Region Extraction algorithm, which replaces the feature points with small super
pixels as feature blocks and then merges the neighboring blocks that have similar local color features
into the feature blocks to generate the merged regions; finally, it applies the morphological operation to
the merged regions to generate the detected forgery regions. The experimental results indicate that the
proposed copy-move forgery detection scheme can achieve much better detection results even under
various challenging conditions compared with the existing state-of-the-art copy-move forgery detection
methods.

INTRODUCTION:
The existing types of image tampering, a common manipulation of a digital image is copy-move forgery,
which is to paste one or several copied region(s) of an image into other part(s) of the same image
During the copy and move operations, some image processing methods such as rotation, scaling,
blurring, compression, and noise addition are occasionally applied to make convincing forgeries.
Because the copy and move parts are copied from the same image, the noise component, color
character and other important properties are compatible with the remainder of the image; some of the
forgery detection methods that are based on the related image properties are not applicable in this
case. According to the existing methods, the copy-move forgery detection methods can be categorized
into two main categories: block-based algorithms and feature key point-based algorithms.

BACKGROUND:
Faculty of CS&IT, Superior University Lahore, Pakistan ii
Project Report: < Image Forgery Detection>
The goal in copy-move forgery detection is detecting duplicated image regions, even if they are slightly
different from each other. One direct solution to this problem would be an exhaustive search, which
involves comparison of the image to every cyclic-shifted version of itself. However, this approach would
be computationally very expensive and would take (MN) 2 steps for an image of size M x N. Also, this
type of search might not work in the case where the copied area has undergone some modifications.
A second and more efficient approach, which was proposed by, is the use of autocorrelation properties.
Nevertheless, this approach is shown to be effective only when the duplicated regions were a large
portion of the image. Another approach, which is the main interest of this paper, is block-matching
procedure. In this approach, the image is segmented into overlapping blocks first. The task here is to
detect connected image blocks that are copied and moved, instead of detecting the whole duplicated
region. Note that the copied region would consist of many overlapping blocks and since each block
would be moved with the same amount of shift, the distance between each duplicated block pair would
be the same, as well. Therefore, the forgery decision can be made only if there are more than a certain
number of similar image blocks within the same distance and these blocks are connected to each other
so that they form two regions of the same shape.

Faculty of CS&IT, Superior University Lahore, Pakistan iii


Project Report: < Image Forgery Detection>

PROPOSED METHOD:
This section describes the proposed image forgery detection using adaptive over-
segmentation and feature point matching in detail. Fig. 1 shows the framework of the
proposed image forgery detection scheme. First, an adaptive over-segmentation method is
proposed to segment the host image into non-overlapping and irregular blocks called Image
Blocks (IB). Then, we apply the Scale Invariant Feature Transform (SIFT) in each block to
extract the SIFT feature points as Block Features (BF). Subsequently, the block features are
matched with one another, and the feature points that are successfully matched to one
another are determined to be Labeled Feature Points (LFP), which can approximately
indicate the suspected forgery regions. Finally, we propose the Forgery Region Extraction
method to detect the forgery region from the host image according to the extracted LFP. 
Project Report: < Image Forgery Detection>

SOFTWARE AND HARDWARE REQUIREMENTS

SYSTEM REQUIREMENTS
 Operating system - Windows XP/7/8/8.1/10.
 Coding Language - MATLAB
 Tool - MATLAB R 2019

HARDWARE REQUIREMENTS
 System - minimum 2.4 GHz.
 Hard Disk  - minimum 40 GB.
 Floppy Drive - 1.44 Mb.
 LCD - 256 VGA Colour.
 Mouse - Logitech.
 RAM – minimum 2 Mb.

RESULTS:
Project Report: < Image Forgery Detection>

Clone Detection:
Clone detection, by its nature, is a computationally expensive algorithm. Whilst in
principle it’s possible to match each pixel with another to create a match, not only
Project Report: < Image Forgery Detection>

would this become far too complex on any standard image (the same 500 x 500px
image discussed above would require 500! comparisons, roughly 1.22x10 1134),

Many images contain repeating information that is in no way duplicated, for example a
brick wall is bound to contain a few 16 x 16 block matches. A simple solution to this
problem is to calculate the distance vector of the two matching blocks, as computed
by:

|(x2 − x1), (y2 − y1)|

Where by (x1, y1) and (x2, y2) are the coordinates of the first and second blocks,
respectively.

Copy-Paste Clone Detection


In addition, part of the algorithm requires a 16 x 16 extended quantization matrix to be
generated. A simple MATLAB implementation was created based upon a standard
calculation formula [8] in order to populate this extended matrix:
% Standard JPEG q u a n t i z a t io n 8 x8 matrix

quMatrix = [ 4 4 6 11 24 24 24 24
4 5 6 16 24 24 24 24
6 6 14 24 24 24 24 24
11 16 24 24 24 24 24 24
24 24 24 24 24 24 24 24
24 24 24 24 24 24 24 24
24 24 24 24 24 24 24 24
24 24 24 24 24 24 24 2 4 ] ;

quMatrix16 = z e ro s ( 1 6 , 1 6 ) ;

% C a l c u l a t e 16 x 16 matrix
fori=1:8
forj=1:8
quMatrix16 ( i , j ) = quMatrix ( i , j ) ∗ 2 . 5
; end
end

quMatrix16 ( 1 , 1 ) = 2 . 0 ∗ quMatrix ( 1 , 1 ) ;

f o r i = 9 : 16
forj=1:8
quMatrix16 ( i , j ) = quMatrix ( 1 , 8 ) ∗ 2 . 5
end
end

f o r i = 9 : 16
forj=9:16
end
Project Report: < Image Forgery Detection>

end quMatrix16 ( i , j ) = quMatrix ( 8 , 8 ) ∗ 2 . 5 ;

fori=1:8
forj=9:16
quMatrix16 ( i , j ) = quMatrix ( 8 , 1 ) ∗ 2 . 5 ;
end
end
Project Report: < Image Forgery Detection>

Once the current block has been quantized, it is converted into a single vector, which
allows us to store each block as a row within a new matrix. However as previously
stated, constant updating of matrix records is slow, and therefore we instead store the
block as a single row within a cell structure in order to improve efficiency:

qSubImageArray = reshape ( quSubImage ’ , 1 , [ ] ) ; quanti s e d


Val ue s Ce l l { counter , 1 } = qSubImageArray ;

At this stage, we also store the x and y coordinates of the top left pixel. This allows us
to reduce the number of comparisons needed later as we aren’t then required to
match each row to its original coordinates. Lexicographical sorting is possible by
utilising MATLAB’s sortrows() function, however this can only be run on standard
matrices. A conversion of the overall cell structure to a standard matrix allows us to
sort the matrix in its entirety, before converting it back to a cell structure for the
comparison stage of the algorithm.

% Find i f t h i s s h i f t vector e x i s t s
does Exist = strcmp ( l o c a l S h i f t , s h i f t V e c t
o r s ) ; does Exist = any ( does Exist ( : ) ) ;

% Does e x i s t , so f in d index and increase count by 1


i f does Exist
l o c a l I n d e x = f i n d ( strcmp ( l o c a l S h i f t , s h i f t V e c t
o r s ) ) ; s h i f t V e c t o r s { l o c al Inde x , 2 } = s h i f t V e c t o r s
{ l o c al Inde x , 2 } + 1 ;
s h i f t V e c t o r s { l o c al Inde x , 3 } = s t r c a t ( s h i f t V e c t o r s { l o c al Inde x , 3 } ,
{ ’ ’ } , x12 ) ; s h i f t V e c t o r s { l o c al Inde x , 4 } = s t r c a t ( s h i f t V e c t o r s { l o c
al Inde x , 4 } , { ’ ’ } , y12 ) ;

% Doesn ’ t e x i s t , so we need to f in d the current new row and append


else
s h i f t V e c t o r s { currentRow , 1 } = l o c
a l S h i f t ; s h i f t V e c t o r s { currentRow ,
2}=1;

s h i f t V e c t o r s { currentRow , 3 } = s t r c a t ( s h i f t V e c t o r s { currentRow , 3 } , { ’
’ } , x12 ) ; s h i f t V e c t o r s { currentRow , 4 } = s t r c a t ( s h i f t V e c t o r s {
currentRow , 4 } , { ’ ’ } , y12 ) ;

currentRow = currentRow + 1 ;
end

Finally, we approach the end of the algorithm with a cell structure containing each shift
vector, its number of occurrences and the coordinates that contributed towards that
particular shift vector. It is then a case of simply detecting which shift vectors occur
more times than noted in our chosen threshold value, which gives us the regions to be
Project Report: < Image Forgery Detection>

highlighted as potential forgeries. Each coordinate pair is then plotted on the source
image, with the 16 x 16 pixel region around each pair highlighted in order to match the
blocks processed within the algorithm.

Results & Evaluation


Copy-Paste Clone Detection
The copy-paste detection algorithm operates on multiple image formats, as it does not
rely on any inaccuracies or changes due to quantization or compression techniques.
However, whilst the algorithm was run on all 45 image samples, it is important to note
that by design it will only detect a specific type of image forgery; that is where regions
have been copied and pasted from existing areas within the original image. It would
therefore be unfair to assume that forgeries containing new objects would also be
detected by the algorithm.

Threshold Value

Figure 6: Forged JPEG Image (3).


Project Report: < Image Forgery Detection>

Figure 7: Clone detection result at a threshold of 10 and a quality value of 0.5. Notice
the false positives in the sky and clouds.

Figure 8: Clone detection result at a threshold of 300. Whilst we have


reduced some false positives, we’ve also stopped detection of the cloned
chimneys.
Project Report: < Image Forgery Detection>

Figure 9: Forged JPEG Image (5).

Figure 10: Clone detection as a result of a quality factor of 0.2 and a threshold value
of 10. Notice the lack of detection
Project Report: < Image Forgery Detection>

Figure 11: Clone detection as a result increasing the quality factor to 0.5. The cloned
bikes have been detected with a few false positives

Figure 12: Clone detection as a result of further increasing the quality factor.
Project Report: < Image Forgery Detection>

Figure 13: Forged Image (r3) Here the crow has been correctly highlighted, along
with some false positives. The contrast of the crow block has been increased for
clarity.

Figure 14: Forged Image (r11) The background has been highlighted as it is all one
shade of blue. However the cloned sections of the horse statue are correctly
identified.

Whilst adjusting the quality factor can have a large impact on how similarly looking
each 16 x 16 block appears, even minor variations within image regions can have an
impact on the detection results of the algorithm. For example, in the dataset image
below, both trees are clearly duplicates, and look very similar at a 100% view level.
Project Report: < Image Forgery Detection>

Figure 15: Forged Image (r7). Notice the two duplicated trees on either side of the
frame.

Displaying both trees at a very high zoom level shows that whilst they are indeed
similar, re-sampling has occurred which has modified clusters of pixels slightly:

Figure 16: The right and left hand side trees, respectively. Slight variations exist between both
images, despite aligning up exactly.

The algorithm would therefore detect each of these 16 x 16 blocks as different, causing
the forgery to remain undetected. Whilst the quality factor could be increased, this
would also have create too many false positives. Many images contain naturally
occurring patterns, and false positives are inevitable with an algorithm of this detail. Out
of the images successfully tested, each image contained at least one false positive block.
Using the penguin forgery image as shown in the Error Level Analysis section, here we
see here that even though both penguins have been flagged as duplicated, the majority
of the sea has also been flagged as a cloned region:
Project Report: < Image Forgery Detection>

Figure 17: Forged Image (8). The two darker penguins have been cloned.

Figure 18: Resulting clone image, with the background contrast increased in order to better
show the false positives.

This also has the effect of dramatically increasing the runtime of the algorithm, taking
242 seconds to complete. Images that failed to produce any results within a reasonable
time frame generally had large amounts of natural patterns, such as this example
image:
Project Report: < Image Forgery Detection>

Figure 19: Forged Image (9). Here the sky is largely one shade of blue, which produces too many
results.
Algorithm Performance
The performance of the algorithm varies significantly depending on the nature of the
image used. As mentioned above, more complex images with naturally occurring
patterns increase the runtime substantially, sometimes to the point where the
algorithm no longer completes successfully. The smallest computation time on a
successfully detected forged image was 24.95 seconds, whereas the largest recorded
time was 242.65 seconds, taking almost 10x longer to compute. In addition, the
number of operations is highly dependent on the total amount of pixels within the
image. Each image used as part of the sample data had a width of 500px, and
reducing the size of an image had a dramatic effect on the computation time of the
algorithm. Image sample 5, is a 500px x 375px image that took an average of 24.95
seconds to compute. Halving this image resolution meant that the algorithm took a
mere 3.32 seconds to complete. Each pixel is read by the 16 x 16 moving window, and
so increasing the resolution increases the number of comparisons required when working
through the entire algorithm.
However, it’s important to note that MATLAB is an interpreted language, and that
performance would vary substantially depending on the language used for the
implementation. Whilst the overall performance of MATLAB’s image processing is
impressive, it tends to falter slightly when large operations are required within
different looping sections.
Project Report: < Image Forgery Detection>

Overall, whilst the general detection rate of the algorithm is acceptable, it excels when
used on known copy-paste cloning forgeries, resulting in a high detection rate. Many
images are manipulated in this way, and whilst re-compression and resampling can
negatively affect the ability of the algorithm, it is able to detect these specific forgeries
in the majority of cases. Performance could be improved if required by utilizing multi-
threading, which in turn would allow images of a larger resolution to also be used.

CONCLUSION:
Digital forgery images created with copy-move operations are challenging to detect. In this paper,
we have proposed a novel copy-move forgery detection scheme using adaptive over-segmentation
and feature-point matching. The Adaptive Over-Segmentation algorithm is proposed to segment the
host image into non-overlapping and irregular blocks adaptively according to the given host images;
using this approach, for each image, we can determine an appropriate block initial size to enhance
the accuracy of the forgery detection results and, at the same time, reduce the computational
expenses. Then, in each block, the feature points are extracted as block features, and the Block
Feature Matching algorithm is proposed, with which the block features are matched with one
another to locate the labeled feature points; this procedure can approximately indicate the
suspected forgery regions. Subsequently, to detect the more accurate forgery regions, we propose
the Forgery Region Extraction algorithm, in which the labeled feature points are replaced with small
superpixels as feature blocks, and the neighboring feature blocks with local color features that are
similar to the feature blocks are merged to generate the merged regions. Next, the morphological
operation is applied to the merged regions to generate the detected forgery regions. We
demonstrate the effectiveness of the proposed scheme with a large number of experiments.
Experimental results show that the proposed scheme can achieve much better detection results for
copy-move forgery images under various challenging conditions, such as geometric transforms,
JPEG compression, and down-sampling, compared with the existing state-of-the-art copy-move
forgery detection schemes. Future work could focus on applying the proposed forgery detection
scheme based on adaptive over-segmentation and feature-point matching on other types of
forgery, such as splicing or other types of media, for example, video and audio.

REFERENCES
[1 ] A. J. Fridrich, B. D. Soukal, and A. J. Lukáš, "Detection of copy-move forgery in digital images," in
in Proceedings of Digital Forensic Research Workshop, 2003.
[2] A. C. Popescu and H. Farid, "Exposing digital forgeries by detecting duplicated image regions,"
Dept. Comput. Sci., Dartmouth College, Tech. Rep. TR2004-515, 2004.
[3] W. Luo, J. Huang, and G. Qiu, "Robust detection of region-duplication forgery in digital image," in
Pattern Recognition, 2006. ICPR 2006. 18th International Conference on, 2006, pp. 746-749.
[4] G. Li, Q. Wu, D. Tu, and S. Sun, "A sorted neighborhood approach for detecting duplicated
regions in image forgeries based on DWT and SVD," in Multimedia and Expo, 2007 IEEE
International Conference on, 2007, pp. 1750-1753.
[5] B. Mahdian and S. Saic, "Detection of copy–move forgery using a method based on blur
moment invariants," Forensic science international, vol. 171, pp. 180-189, 200
Project Report: < Image Forgery Detection>

You might also like