# Structural Correlation Based Method for Image Forgery Classification and Localization
## 4 Image Forgery Clustering  
In this section, we give an exposition of the proposed image forgery clustering algorithm. Suppose that we have an input dataset including authentic and tampered images. The proposed algorithm classifies images into separate clusters, where each cluster consists of tampered images which were composed using an identical host image and that host image. Subsequently, the proposed algorithm finds the host image to be the centroid of each image cluster. The details of images clustering and centroid determination are provided in Algorithm 1. Firstly, we randomly select a query image \(\mathbf{Q}\) in the dataset. The ranking score of a database image \(\mathbf{P}\) in the query of \(\mathbf{Q}\) is denoted as \(\Omega_{\mathbf{Q}}^{\mathbf{P}}\) and calculated as the similarity between two images according to Equation (4). The retrieval results are a list of images arranged in descending order of ranking scores. A cut-off threshold \(\theta\) is set to obtain the set of images. Let us denote \(\breve{\mathbf{Q}}\) as the host image of the image \(\mathbf{Q}\) in the dataset. An authentic image is considered as the host image of itself. We need to retrieve all the relevant images \(\mathbf{R}\) to the query \(\mathbf{Q}\) satisfying \(\mathbf{R}=\breve{\mathbf{Q}}\). To this end, we set the threshold \(\theta\) to a relatively low value. This low threshold value leads to the case where also some irrelevant images may be retrieved together. Note that, the irrelevantly retrieved images will be discarded in the last step of the iteration. Due to the insignificant processing time of these operations, we can easily handle the case of a large number of images in a cluster. Further, we perform an additional query to ensure that all the relevant images to \(\mathbf{Q}\) are retrieved. Notice that the top ranked image in retrieved list \(\mathbb{L}_{1}\), image \(\mathbf{D}_{1}\) is identical to the query image \(\mathbf{Q}\). Therefore, the second highest ranked result in \(\mathbb{L}_{1}\), image \(\mathbf{D}_{2}\), is selected as the query image. The score threshold \(\theta\) is also used in this query, then we obtain the set of retrieved images \(\mathbb{L}_{2}\). The image cluster \(\mathbb{C}\) is the union of two sets of retrieved images, i.e., \(\mathbb{C}=\mathbb{L}_{1}\cup\mathbb{L}_{2}\). The centroid of \(\mathbb{C}\) is determined based on two criteria which measure the correlations in structure and luminance among images in the cluster. In this work, we extract SIFT features [33] in images and use Random Sample Consensus [42] to find the matching. Let \(\mathbb{K}_{\mathbf{U}\mathbf{V}}=\left\{(\mathbf{k}_{\mathbf{U}}^{1}, \mathbf{k}_{\mathbf{V}}^{1}),(\mathbf{k}_{\mathbf{U}}^{2},\mathbf{k}_{\mathbf{ V}}^{2}),\dots\right\}\) denote the set of matched keypoints between two images \(\mathbf{U}\) and \(\mathbf{V}\) in \(\mathbb{C}\) where \((\mathbf{k}_{\mathbf{U}}^{i},\mathbf{k}_{\mathbf{V}}^{i})\) is a pair of keypoints. Then \(s_{\mathbf{U}\mathbf{V}}=|\mathbb{K}_{\mathbf{U}\mathbf{V}}|\) is the number of matching keypoints between \(\mathbf{U}\) and \(\mathbf{V}\). We denote by \(c_{\mathbf{U}}^{i}\) the pixel coordinates of \(\mathbf{k}_{\mathbf{U}}^{i}\) in \(\mathbf{U}\). The number of matching keypoints in the corresponding positions of \(\mathbf{U}\) and \(\mathbf{V}\), denoted by \(\hat{s}_{\mathbf{U}\mathbf{V}}\), is calculated as follows:  
\[\hat{s}_{\mathbf{U}\mathbf{V}}=\sum\limits_{i=1}^{s_{\mathbf{U}\mathbf{V}}} \delta(c_{\mathbf{U}}^{i},c_{\mathbf{V}}^{i}), \tag{5}\]where \(\delta\) is the Kronecker delta function:  
\[\delta(a,b)= \begin{cases}1,&\text{if }a=b,\\ 0,&\text{if }a\
eq b.\end{cases}  \tag{6}\]  
We define the ratio \(\hat{s}_{\mathbf{UV}}/s_{\mathbf{UV}}\) as the structural similarity between \(\mathbf{U}\) and \(\mathbf{V}\).