# Image Hashing Algorithm Based on Mirror Flipping and a Three-Dimensional Space Angle

Authors: Yan Zhao; Shuai Liu
Journal: Wireless Communications and Mobile Computing
 (2021)

---

## Abstract

In order to make full use of image flipping information to get comprehensive image features and improve the distinguishing performance of hash algorithm, this paper proposes a new image hashing algorithm based on mirror flipping and a three-dimensional space angle. Firstly, the original image is preprocessed and then combined with mirror flipping image to obtain the new luminance component and opposite color components. Then, we combine new luminance component with the different sizes of structural elements to construct morphological features. The new opposite color components are used to construct a three-dimensional space. The angle between vectors formed by the pixels in the three-dimensional space is computed to construct the space angle features. Finally, the morphological features and space angle features are combined and disturbed to form the final hash sequence. Simulation results show that the algorithm has good security and tamper image recognition accuracy. Compared with some existing algorithms, it has better image classification performance and shorter computation time.


---

## Body

## 1. Introduction

With the rapid development of Internet technology, multimedia information security is becoming more and more important in people’s life. Image hashing is an important part of multimedia information security. Nowadays, individuals have the ability to easily and rapidly process the images on computers, mobile phones, and other digital devices. In addition, the modern image editing tools allow the individuals to temper the content of images. These changes are very hard to be distinguished by the naked eye. The analysis for detecting the tampered parts of the image requires expertise and time. Thus, there is a need to devise methods that allow the concerned individuals to assess the image authenticity and detect the changes. The image hashing technology is an important and effective method to solve the aforementioned problem.Image hash refers to a unidirectional mapping of an image to a sequence of numbers. These numbers can be binary or decimal. The image hashing should be robustness, discrimination, and key secure. The robustness means that the hash sequence of the original image after processing should preserve the digital content and should be the similar to the hash sequence of the original unprocessed image. The discrimination means that the hash sequences of different images should be significantly different when subject to same hash mapping; i.e., the probability of collision of hash sequences for different images should be very small. The key security refers to the failure of an attacker to obtain the correct hash sequence without knowing the correct key. These features enable the image hashing to be applied to image retrieval, image classification, and image tamper detection. The previous hashing algorithms use two-dimensional plane features or global features of a three-dimensional space. All of them have good performance. But it is noticeable that the algorithms based on a three-dimensional space may ignore some three-dimensional local features. And image mirror flipping has more useful image information. Therefore, image classification performance of existing image hash algorithms can be improved. In this paper, we combine the image flipping of the image component with the local features of the three-dimensional space to construct the hash sequence. This method makes full improvement of the classification performance of hashing algorithm.


## 2. Related Work

There are different methods proposed in recent literature for performing image hashing. These methods are majorly divided into two categories, namely, spatial domain methods and transform domain methods.


### 2.1. Spatial Domain Methods

In [1], Tang et al. proposed an image hashing algorithm based on local color features. The proposed technique extracts are featured from HSI space and YCbCr space, in order to obtain image hashing. The algorithm proposed in [1] is robust to most of the image processing operations; however, the algorithm performs poorly for the rotated images. The authors in [2] presented an algorithm that is based on opposite colors and quadtree decomposition of image hashing algorithm. The proposed algorithm effectively localizes the tampers in the image. The authors in [3] proposed an image hashing scheme that combines color vector angle (CVA) and Canny operator. The features obtained from the CVA and the edges are combined to compute the hash sequence. This algorithm performs efficiently against image rotation, brightness contrast adjustment, and other attacks. However, the discrimination of this technique is not ideal. Qin et al. in [4] proposed an image hashing technique based on hybrid structure of the color image perception. The proposed algorithm performs image preprocessing by performing image normalization, Gaussian low-pass filtering, and singular value decomposition (SVD). After preprocessing, the algorithm performs edge detection and computes the CVA. The edge information and the CVA are used to obtain the hash sequence. It is noticeable that as compared to the aforementioned CVA-based technique, this algorithm showcases better robustness and discrimination. However, this method is less robust to the changes in brightness. Tang et al. proposed an image hashing technique based on ring segmentation and invariant vector distance [5]. This technique extracts statistical features from the image segmentation ring to construct the image hashing, as the features extracted from within the image segmentation ring are invariant to rotation. The robustness of this algorithm can be further improved. In [6], Tang et al. proposed an image hashing technique that makes use of visual attention model and the invariant moments. In this method, the visual significance model and invariant moments are used to construct the hash sequence. This technique performs effectively against the conventional attacks, such as brightness and contrast, but performs poorly against image rotation and cropping attacks. In [7], Zhao et al. proposed an image hashing algorithm based on Zernike moments and significant regions. The method proposed in [7] performs authentication effectively and can be used for tampering and positioning. In [8], Davarzani et al. proposed a hashing scheme based on the central local symmetric binary mode (CS-LBP) and SVD. This method is robust against brightness and JPEG compression. In addition, this technique has the capability to locate tampering. However, this algorithm performs poorly against rotation.


### 2.2. Transform Domain Methods

In [9], Tang et al. proposed a robust image hashing based on CVA. This algorithm first extracts the CVA from the input image and then computes the pixel histogram from within the maximum inscribed circle of the image. The extracted information is then combined with the discrete cosine transform (DCT) for generating the image hashing. This algorithm is robust and secure; however, the different color may generate same CVA which affects the performance. In [10], Qin et al. proposed an image hashing technique that uses significant structural features. This technique performs efficient edge detection. On the basis of edge information, some nonoverlapping image blocks containing rich information are adopted. Finally, DCT is used to obtain the final hash sequence. The algorithm is secure and robust, but the scheme only uses some boundary information, and some local information may be omitted. This may lead to performance degradation. In [11], Tang et al. proposed an image hashing algorithm based on DCT and local linear embedding (LLE). This method first extracts the CVA of the image and then extracts the feature matrix on the basis of DCT. The hash sequence is computed by combining the LLE. This scheme is robust to various transformations but is not effective against rotations at large angles. In [12], Tang et al. proposed an image hashing technique that uses multidimensional scaling (MDS) analysis. In this algorithm, log-polar transform (LPT) and discrete Fourier transform (DFT) are successively applied to the image for extracting the rotation invariant feature matrix. The final hash sequence is obtained using the MDS. This algorithm is robust to rotations, but it is inefficient.Moreover, there are some image hashing algorithms, such as algorithms based on tensor decomposition (TD) [13], methods based on Laplacian Pyramids [14], methods based on two-dimensional principal component analysis (PCA) [15], techniques based on the structure and gradient hashing algorithm [16, 17], and techniques based on the cool and warm hue [18].All the above hashing algorithms have good performance, but none of them combine the image flipping, two-dimensional plane features, and three-dimensional space local features of image components to construct the hash sequence. In this work, we propose an image hashing algorithm based on the mirror flipping and a three-dimensional space angle. The proposed algorithms significantly consider the two-dimensional global features of luminance and opposite colors of three-dimensional space local features. The algorithm combines mirror flipping for the image components in a three-dimensional space of each small build specific three-dimensional space coordinates and extracts the features of a three-dimensional space angle. The proposed algorithm shows robustness and discrimination. In addition, the proposed algorithm shows the key security. The contributions of this work are as follows.(1)
We lead the idea of image mirroring flipping into image hashing; hash sequence is constructed by combining the image component after the mirror flipping with the image component; the image after mirroring flipping can provide more useful information, which is something that was never mentioned in the previous hashing algorithm. The experimental results show that the introduction of mirror flipping can improve the image classification and tamper detection performance(2)
This algorithm is different from the previous hashing algorithm based on the three-dimensional space of image component [16, 17], which is mainly based on the global feature of a single image component. In this paper, the image component and the image component after mirror flipping are combined. Then, three-dimensional coordinates for each block are built to extract the local features of the image components in a three-dimensional space. Compared with previous algorithms based on a three-dimensional space, this algorithm can get more image information and extract more detailed image features in a three-dimensional space so as to improve the performance of the algorithmSimulation results reveal that the proposed algorithm has better discriminability and better ROC curve as compared to other algorithms presented in literature. The average computation time of the proposed hashing algorithm is shorter.


## 2.1. Spatial Domain Methods

In [1], Tang et al. proposed an image hashing algorithm based on local color features. The proposed technique extracts are featured from HSI space and YCbCr space, in order to obtain image hashing. The algorithm proposed in [1] is robust to most of the image processing operations; however, the algorithm performs poorly for the rotated images. The authors in [2] presented an algorithm that is based on opposite colors and quadtree decomposition of image hashing algorithm. The proposed algorithm effectively localizes the tampers in the image. The authors in [3] proposed an image hashing scheme that combines color vector angle (CVA) and Canny operator. The features obtained from the CVA and the edges are combined to compute the hash sequence. This algorithm performs efficiently against image rotation, brightness contrast adjustment, and other attacks. However, the discrimination of this technique is not ideal. Qin et al. in [4] proposed an image hashing technique based on hybrid structure of the color image perception. The proposed algorithm performs image preprocessing by performing image normalization, Gaussian low-pass filtering, and singular value decomposition (SVD). After preprocessing, the algorithm performs edge detection and computes the CVA. The edge information and the CVA are used to obtain the hash sequence. It is noticeable that as compared to the aforementioned CVA-based technique, this algorithm showcases better robustness and discrimination. However, this method is less robust to the changes in brightness. Tang et al. proposed an image hashing technique based on ring segmentation and invariant vector distance [5]. This technique extracts statistical features from the image segmentation ring to construct the image hashing, as the features extracted from within the image segmentation ring are invariant to rotation. The robustness of this algorithm can be further improved. In [6], Tang et al. proposed an image hashing technique that makes use of visual attention model and the invariant moments. In this method, the visual significance model and invariant moments are used to construct the hash sequence. This technique performs effectively against the conventional attacks, such as brightness and contrast, but performs poorly against image rotation and cropping attacks. In [7], Zhao et al. proposed an image hashing algorithm based on Zernike moments and significant regions. The method proposed in [7] performs authentication effectively and can be used for tampering and positioning. In [8], Davarzani et al. proposed a hashing scheme based on the central local symmetric binary mode (CS-LBP) and SVD. This method is robust against brightness and JPEG compression. In addition, this technique has the capability to locate tampering. However, this algorithm performs poorly against rotation.


## 2.2. Transform Domain Methods

In [9], Tang et al. proposed a robust image hashing based on CVA. This algorithm first extracts the CVA from the input image and then computes the pixel histogram from within the maximum inscribed circle of the image. The extracted information is then combined with the discrete cosine transform (DCT) for generating the image hashing. This algorithm is robust and secure; however, the different color may generate same CVA which affects the performance. In [10], Qin et al. proposed an image hashing technique that uses significant structural features. This technique performs efficient edge detection. On the basis of edge information, some nonoverlapping image blocks containing rich information are adopted. Finally, DCT is used to obtain the final hash sequence. The algorithm is secure and robust, but the scheme only uses some boundary information, and some local information may be omitted. This may lead to performance degradation. In [11], Tang et al. proposed an image hashing algorithm based on DCT and local linear embedding (LLE). This method first extracts the CVA of the image and then extracts the feature matrix on the basis of DCT. The hash sequence is computed by combining the LLE. This scheme is robust to various transformations but is not effective against rotations at large angles. In [12], Tang et al. proposed an image hashing technique that uses multidimensional scaling (MDS) analysis. In this algorithm, log-polar transform (LPT) and discrete Fourier transform (DFT) are successively applied to the image for extracting the rotation invariant feature matrix. The final hash sequence is obtained using the MDS. This algorithm is robust to rotations, but it is inefficient.Moreover, there are some image hashing algorithms, such as algorithms based on tensor decomposition (TD) [13], methods based on Laplacian Pyramids [14], methods based on two-dimensional principal component analysis (PCA) [15], techniques based on the structure and gradient hashing algorithm [16, 17], and techniques based on the cool and warm hue [18].All the above hashing algorithms have good performance, but none of them combine the image flipping, two-dimensional plane features, and three-dimensional space local features of image components to construct the hash sequence. In this work, we propose an image hashing algorithm based on the mirror flipping and a three-dimensional space angle. The proposed algorithms significantly consider the two-dimensional global features of luminance and opposite colors of three-dimensional space local features. The algorithm combines mirror flipping for the image components in a three-dimensional space of each small build specific three-dimensional space coordinates and extracts the features of a three-dimensional space angle. The proposed algorithm shows robustness and discrimination. In addition, the proposed algorithm shows the key security. The contributions of this work are as follows.(1)
We lead the idea of image mirroring flipping into image hashing; hash sequence is constructed by combining the image component after the mirror flipping with the image component; the image after mirroring flipping can provide more useful information, which is something that was never mentioned in the previous hashing algorithm. The experimental results show that the introduction of mirror flipping can improve the image classification and tamper detection performance(2)
This algorithm is different from the previous hashing algorithm based on the three-dimensional space of image component [16, 17], which is mainly based on the global feature of a single image component. In this paper, the image component and the image component after mirror flipping are combined. Then, three-dimensional coordinates for each block are built to extract the local features of the image components in a three-dimensional space. Compared with previous algorithms based on a three-dimensional space, this algorithm can get more image information and extract more detailed image features in a three-dimensional space so as to improve the performance of the algorithmSimulation results reveal that the proposed algorithm has better discriminability and better ROC curve as compared to other algorithms presented in literature. The average computation time of the proposed hashing algorithm is shorter.


## 3. Image Hashing Algorithm Based on Mirror Flipping and a Space Angle

### 3.1. Hashing Algorithm Framework

The flowchart of the proposed image hashing algorithm is presented in Figure1. The major components of the proposed algorithm comprise image preprocessing, image mirror flipping and superposition of each component, extraction of morphological features, extraction of three-dimensional space angle features, and generation of hash sequence. In the following subsections, we discuss each component of the proposed algorithm in detail.Figure 1
The flowchart of the proposed image hashing algorithms.


### 3.2. Image Preprocessing

At first, the input imageI is resized to N×N by applying bilinear interpolation. This allows us to generate the hash sequence with same length for each input image. Then, we smooth the image by applying Gaussian low-pass filter. This is done in order to reduce the influence of noise. The resultant image I0 is obtained for the corresponding input image I.


### 3.3. Image Mirror Flipping

In this work, we proposed a technique called mirror flipping. The mirror flipping refers to the process of flipping the left and right sides of the preprocessed image along the vertical axis. The imageI0 after mirror flipping is named I1. Figure 2(a) is the original image, and Figure 2(b) is the mirror flipping image.Figure 2
Image mirroring flipping.
(a)(b)Then, we compute the RG and BY colors [19, 20] by using the following equations.
(1)RG=TRx,y−TGx,y,(2)BY=TBx,y−TYx,y,where TRx,y, TGx,y, TBx,y, and TYx,y are defined as equations [3–6].
(3)TRx,y=frx,y−fgx,y+fbx,y2,(4)TGx,y=fgx,y−frx,y+fbx,y2,(5)TBx,y=fbx,y−frx,y+fgx,y2,(6)TYx,y=−TBx,y−∣frx,y−fgx,y∣2,where frx,y, fgx,y, and fbx,y represent the red, green, and blue channels of RGB color space, respectively.The imageI0 is obtained after preprocessing original image and used to extract the opposite color components RG0 and BY0. I1 is I0 after mirror flipping; I1 is used to extract the opposite color components RG1 and BY1. We add RG0 and RG1 to compute the opposite color component RG2. Similarly, add BY0 and BY1 to compute the opposite color component BY2. Finally, we transform the images I0 and I1 from RGB color space to YCbCr color space. The luminance Y0 and Y1 are extracted from I0 and I1. We add Y0 and Y1 to compute the luminance component Y2.


### 3.4. Morphological Features

We perform adaptive histogram equalization and luminance adjusted on the luminance componentY2 to obtain Y3. Y3 is used to perform the open operations, i.e., the construction of element specified as “diamond” and which has a distance “d” from the origin. When “d=1”, the operation on Y3 results in Y4. When “d=2”, the operation performed on Y3 results in Y5. Y4 subtracts Y5 obtains Y6. In this process, it is called the parameter “d=1,2”.Finally, we divide the luminance componentY6 into M×M nonoverlapping blocks of equal size. We compute the standard deviation Si,j of the pixels contained in each block, get the matrixS. The dimensions of matrix S are M×M. Each row of the matrix is connected to the hash sequence H1n, where 1≤n≤M.


### 3.5. Three-Dimensional Space Angle Features

Let (x,y) represent the pixel location and z represent the value of the pixel at location (x,y). Then, considering the location variables, i.e., (x,y), and the value variable, i.e., z, we can represent the image in a three-dimensional space. The RG2 in a three-dimensional space are presented in Figure 3(a).Figure 3
(a) TheRG2 images in a three-dimensional space. (b) The coordinates of RG2’s blocks of the image in a three-dimensional space.
(a)(b)In this work, we divide the imagesRG2 and BY2 into M×M nonoverlapping blocks of equal size. In order to construct these images with a three-dimensional space, we consider the number of small block’s rows i of the image along the x-axis, the number of small block’s columns j of the image along the y-axis, and the average value of the pixels of images RG2 and BY2 in a small block L1i,j and L2i,j along the z-axis. Then, the coordinates of RG2 and BY2 images’ small block in the i-th row and j-th column (i,j) in a three-dimensional space are i,j,L1i,j and i,j,L2i,j. Figure 3(b) presents the coordinates of RG2’s blocks of the image in a three-dimensional space.The three-dimensional space angle features extracted fromRG2 are shown in Figure 4. The three-dimensional space angle features of the image are extracted from small blocks. These small blocks comprise the central pixel at location (i,j) and eight adjacent pixels. First, we estimate the coordinate of the block with position (i,j−1) and (i,j+1) represented by ai,j and ei,j, respectively. Then, we calculate the vector Ai,j by using these two coordinates, i.e., Ai,j=ei,j−ai,j. In a similar fashion, we estimate the coordinates of the little block with positions (i+1,j) and (i−1,j) represented by bi,j and fi,j, respectively. The vector Bi,j is calculated by using these two coordinates, i.e., Bi,j=fi,j−bi,j. Finally, we use the vector Ai,j and the vector Bi,j to calculate cosαi,j in a three-dimensional space.
(7)cosαi,j=Ai,jBi,jAi,jBi,j.Figure 4
The three-dimensional space angle features extracted.The matrixE with M−2×M−2 is composed of cosαi,j, where 2≤i≤M−1 and 2≤j≤M−1.Similarly, we estimate the coordinates of the little block at (i+1, j−1) and (i−1, j+1) represented as ci,j and gi,j, respectively. The vector Ci,j is computed as Ci,j=gi,j−ci,j. In the same way, we estimate the coordinates of the little block at (i+1, j+1) and (i−1, j−1) represented as di,j and hi,j, respectively. The vector Di,j is calculated as Di,j=hi,j−di,j. We use vector Ci,j and vector Di,j to compute cosβi,j in a three-dimensional space as follows:
(8)cosβi,j=Ci,jDi,jCi,jDi,j.The matrixF with M−2×M−2 is composed of cosβi,j, where 2≤i≤M−1 and 2≤j≤M−1.Finally, we add the two matricesE and F to obtain the resultant matrix J. The dimensions of matrix J are M−2×M−2. Each column is successively connected to a vector Jn. And in the same way, a three-dimensional space angle eigenvector J1n is extracted in BY2. We add Jn and J1n to obtain J2n and multiply every number in J2n×10 to get the hash sequence H2n, where 1≤n≤M−22.


### 3.6. Hash Generation

The morphological feature sequenceH1 and the three-dimensional space angle feature sequence H2 are combined to form the intermediate hash sequence Hm=H1H2. It is evident from Sections 3.4 and 3.5 that the resultant hash of the image obtained using the hash algorithm presented in this work has a length equal to LH=2M2−4M+4 decimal numbers. The intermediate hash sequence Hm is perturbed by the key to obtain the final hash sequence H.


## 3.1. Hashing Algorithm Framework

The flowchart of the proposed image hashing algorithm is presented in Figure1. The major components of the proposed algorithm comprise image preprocessing, image mirror flipping and superposition of each component, extraction of morphological features, extraction of three-dimensional space angle features, and generation of hash sequence. In the following subsections, we discuss each component of the proposed algorithm in detail.Figure 1
The flowchart of the proposed image hashing algorithms.


## 3.2. Image Preprocessing

At first, the input imageI is resized to N×N by applying bilinear interpolation. This allows us to generate the hash sequence with same length for each input image. Then, we smooth the image by applying Gaussian low-pass filter. This is done in order to reduce the influence of noise. The resultant image I0 is obtained for the corresponding input image I.


## 3.3. Image Mirror Flipping

In this work, we proposed a technique called mirror flipping. The mirror flipping refers to the process of flipping the left and right sides of the preprocessed image along the vertical axis. The imageI0 after mirror flipping is named I1. Figure 2(a) is the original image, and Figure 2(b) is the mirror flipping image.Figure 2
Image mirroring flipping.
(a)(b)Then, we compute the RG and BY colors [19, 20] by using the following equations.
(1)RG=TRx,y−TGx,y,(2)BY=TBx,y−TYx,y,where TRx,y, TGx,y, TBx,y, and TYx,y are defined as equations [3–6].
(3)TRx,y=frx,y−fgx,y+fbx,y2,(4)TGx,y=fgx,y−frx,y+fbx,y2,(5)TBx,y=fbx,y−frx,y+fgx,y2,(6)TYx,y=−TBx,y−∣frx,y−fgx,y∣2,where frx,y, fgx,y, and fbx,y represent the red, green, and blue channels of RGB color space, respectively.The imageI0 is obtained after preprocessing original image and used to extract the opposite color components RG0 and BY0. I1 is I0 after mirror flipping; I1 is used to extract the opposite color components RG1 and BY1. We add RG0 and RG1 to compute the opposite color component RG2. Similarly, add BY0 and BY1 to compute the opposite color component BY2. Finally, we transform the images I0 and I1 from RGB color space to YCbCr color space. The luminance Y0 and Y1 are extracted from I0 and I1. We add Y0 and Y1 to compute the luminance component Y2.


## 3.4. Morphological Features

We perform adaptive histogram equalization and luminance adjusted on the luminance componentY2 to obtain Y3. Y3 is used to perform the open operations, i.e., the construction of element specified as “diamond” and which has a distance “d” from the origin. When “d=1”, the operation on Y3 results in Y4. When “d=2”, the operation performed on Y3 results in Y5. Y4 subtracts Y5 obtains Y6. In this process, it is called the parameter “d=1,2”.Finally, we divide the luminance componentY6 into M×M nonoverlapping blocks of equal size. We compute the standard deviation Si,j of the pixels contained in each block, get the matrixS. The dimensions of matrix S are M×M. Each row of the matrix is connected to the hash sequence H1n, where 1≤n≤M.


## 3.5. Three-Dimensional Space Angle Features

Let (x,y) represent the pixel location and z represent the value of the pixel at location (x,y). Then, considering the location variables, i.e., (x,y), and the value variable, i.e., z, we can represent the image in a three-dimensional space. The RG2 in a three-dimensional space are presented in Figure 3(a).Figure 3
(a) TheRG2 images in a three-dimensional space. (b) The coordinates of RG2’s blocks of the image in a three-dimensional space.
(a)(b)In this work, we divide the imagesRG2 and BY2 into M×M nonoverlapping blocks of equal size. In order to construct these images with a three-dimensional space, we consider the number of small block’s rows i of the image along the x-axis, the number of small block’s columns j of the image along the y-axis, and the average value of the pixels of images RG2 and BY2 in a small block L1i,j and L2i,j along the z-axis. Then, the coordinates of RG2 and BY2 images’ small block in the i-th row and j-th column (i,j) in a three-dimensional space are i,j,L1i,j and i,j,L2i,j. Figure 3(b) presents the coordinates of RG2’s blocks of the image in a three-dimensional space.The three-dimensional space angle features extracted fromRG2 are shown in Figure 4. The three-dimensional space angle features of the image are extracted from small blocks. These small blocks comprise the central pixel at location (i,j) and eight adjacent pixels. First, we estimate the coordinate of the block with position (i,j−1) and (i,j+1) represented by ai,j and ei,j, respectively. Then, we calculate the vector Ai,j by using these two coordinates, i.e., Ai,j=ei,j−ai,j. In a similar fashion, we estimate the coordinates of the little block with positions (i+1,j) and (i−1,j) represented by bi,j and fi,j, respectively. The vector Bi,j is calculated by using these two coordinates, i.e., Bi,j=fi,j−bi,j. Finally, we use the vector Ai,j and the vector Bi,j to calculate cosαi,j in a three-dimensional space.
(7)cosαi,j=Ai,jBi,jAi,jBi,j.Figure 4
The three-dimensional space angle features extracted.The matrixE with M−2×M−2 is composed of cosαi,j, where 2≤i≤M−1 and 2≤j≤M−1.Similarly, we estimate the coordinates of the little block at (i+1, j−1) and (i−1, j+1) represented as ci,j and gi,j, respectively. The vector Ci,j is computed as Ci,j=gi,j−ci,j. In the same way, we estimate the coordinates of the little block at (i+1, j+1) and (i−1, j−1) represented as di,j and hi,j, respectively. The vector Di,j is calculated as Di,j=hi,j−di,j. We use vector Ci,j and vector Di,j to compute cosβi,j in a three-dimensional space as follows:
(8)cosβi,j=Ci,jDi,jCi,jDi,j.The matrixF with M−2×M−2 is composed of cosβi,j, where 2≤i≤M−1 and 2≤j≤M−1.Finally, we add the two matricesE and F to obtain the resultant matrix J. The dimensions of matrix J are M−2×M−2. Each column is successively connected to a vector Jn. And in the same way, a three-dimensional space angle eigenvector J1n is extracted in BY2. We add Jn and J1n to obtain J2n and multiply every number in J2n×10 to get the hash sequence H2n, where 1≤n≤M−22.


## 3.6. Hash Generation

The morphological feature sequenceH1 and the three-dimensional space angle feature sequence H2 are combined to form the intermediate hash sequence Hm=H1H2. It is evident from Sections 3.4 and 3.5 that the resultant hash of the image obtained using the hash algorithm presented in this work has a length equal to LH=2M2−4M+4 decimal numbers. The intermediate hash sequence Hm is perturbed by the key to obtain the final hash sequence H.


## 4. Experimental Results and Analysis

The parameters that are used in this study and for performing simulations include3×3 Gaussian low-pass kernel with normalized size N=256 and standard deviation 1, d=“1,2”. The numbers of image subblocks are M×M=16×16=256. Thus, the hash length is LH=2M2−4M+4=452 decimal numbers. All experiments were implemented with MATLAB 2018b on a computer, which the CPU is Inter Core i5-8300H with 8 GB memory and Window 10 operating system.


### 4.1. Robustness Experiment

In order to evaluate the robustness of the image hashing algorithm proposed in this work, we use 20 images as test samples. Figure5 represents one of the sample images. We also generate similar images for each test according to the type of attack as presented (Table 1); there are 59 attack samples for each image as test samples of similar images. We use the proposed algorithm to compute the hash sequence of the original image. Similarly, we also compute the hash sequence of a closely similar image. Then, we calculate the Euclidean distance between the two resultants. The Euclidean distance charts are drawn according to attack category. The simulation results for assessing robustness of the proposed algorithm are presented in Figure 6. It is evident from Figure 6 that the JPEG compression, brightness adjustment, contrast adjustment, salt and pepper noise, image scaling, watermark embedding, gamma correction, speckle, and Gaussian filtering have a small fluctuation range in the curve. The Euclidean distance in all cases is less than 165. In the simulations performed to test the algorithms robustness against the rotation attack, we observe that the distance of the rotation attack within 1° of image rotation is small. The distance of the rotation attack gradually increases with the increase in the angle. This is because the proposed algorithm blocks the image, thus making it more sensitive to the rotation attack. In Table 2, we present the statistical results of Euclidean distance for 20 images under different attacks. The presented cases include JPEG compression, brightness adjustment, contrast manipulation, salt and pepper noise, image scaling, watermark embedding, rotation, gamma correction, speckle, and Gaussian filtering. In Table 3, we give the average mean square error (MSE) and peak signal-to-noise ratio (PSNR) values between the original images of five test images and the images generated after the corresponding maximum parameter attack in each attack. For all these attacks, except rotation, the maximum Euclidean distance is less than 165 and the mean and variance are less than 88. The maximum and average Euclidean distance for rotation attack is 226 and 318. The results show that the maximum value of the Euclidean distance is 165 except the rotation attack. This indicates that the proposed algorithm is robust against all types of attacks except large angle rotation attacks, such as JPEG compression, brightness adjustment, contrast adjustment, and other attacks.Figure 5
Color image in robustness experiment.Table 1
Attack setting in robustness experiment.
OperationParameterParameter valuesJPEG compressionQuality30, 40,…,100Brightness adjustmentLevel-20, -10, 10, 20Contrast adjustmentLevel-20, -10, 10, 20Salt and pepperNoise level0.002, 0.004,…,0.01Image resizingRatio0.6, 0.8, 1.2, 1.4, 1.6, 1.83×3 Gaussian filterStandard deviation0.1, 0.2,…,1RotationAngle1, 2, 3,…,7, 8Watermark embeddingTransparency0.3–0.8Gamma correctionGamma0.75, 0.9, 1.1, 1.25SpeckleNoise variance0.002, 0.004,…,0.01Figure 6
Robustness experiment.
(a)
JPEG compression(b)
Brightness adjustment(c)
Contrast adjustment(d)
Salt and pepper(e)
Image resizing(f)
3×3 Gaussian low-pass filter(g)
Rotation(h)
Watermark embedding(i)
Gamma correction(j)
SpeckleTable 2
Euclidean distance in different attacks.
OperationMinMaxMeanSDJPEG5.131275.660932.240819.9104Brightness31.5577138.041761.433727.3783Contrast10.344391.649437.128722.6655Salt and pepper22.034189.751147.000017.1471Image resizing15.257286.300338.160318.6133Gaussian filter22.407254.293337.88139.3474Rotation66.5561317.5768225.617271.9825Watermark2.437733.465811.66419.6917Gamma45.7193164.703987.444132.2778Speckle17.879487.536548.709818.4361Table 3
Mean value of MSE and PSNR.
OperationParameter valuesMSEPSNRJPEG compression1002.756749.7483Brightness adjustment20260.321128.8134Contrast adjustment2011.399942.6260Salt and pepper0.01109.728932.5156Image resizing1.838.263438.61823×3 Gaussian filter183.916335.0653Rotation83805.817.1840Watermark embedding0.82.429149.6675Gamma correction1.25265.229828.7490Speckle0.01120.729832.2695


### 4.2. Discrimination Experiment

We download 1000 images from Ground Truth database [21] and VOC2007 database [22] for performing discrimination analysis of the proposed algorithm. The hash sequences of 1000 images are computed by using the algorithm proposed in this work. Then, we calculate the Euclidean distance between these 1000 images hash sequences. We generate a total of C10002=499,500 different image pairs. The similar image pairs are generated according to Table 4.Table 4
Operations and parameter setting in discrimination experiment.
OperationParameterParameter valuesJPEG compressionQuality factor4080Brightness adjustmentLevel2020Contrast adjustmentLevel2020Salt and pepperNoise level0.0020.006Image resizingRatio0.81.63×3 Gaussian filterStandard deviation0.20.6RotationAngle12Watermark embeddingTransparency0.30.8Gamma correctionGamma0.751.25SpeckleNoise variance0.0020.006Each downloaded image is used to generate 20 similar image pairs. The Euclidean distance between the similar generated images and the original image is calculated. There are21×20/2×1000=210000 pairs of similar images. The distribution of Euclidean distances for similar and different images is presented in Figure 7 for different Euclidean distances and ordinate for the different frequencies of Euclidean distance; find the minimum Euclidean distance between different images by a calculation value of 274.06, similar image on the maximum Euclidean distance of 344.96, and similar and different images of Euclidean distance intersection between 274.06 and 344.96. In order to obtain the optimal value for distinguishing similar image pairs from different image pairs in this work, we use collision rate and error detection rate to perform analysis. The collision rate and error detection rate are computed as follows:
(9)PC=NCND,(10)PE=NENS,where NC and ND represent the number of different image pairs detected as similar image pairs and the total number of different image pairs, respectively. Similarly, NE and NS represent the number of similar image pairs detected as different image pairs and the total number of similar image pairs, respectively. PC and PE represent the collision rate and error detection rate, respectively.Figure 7
The hash distance distribution of similar image pairs and different image pairs.The computation results are presented in Table5. The results presented in Table 5 reveal that the threshold value is 322, and at this point, the algorithm has a low collision rate and a low error detection rate, with good discrimination.Table 5
Threshold selection.
ThresholdCollision rateError detection rate27405.16×10−32864.00×10−62.45×10−33013.40×10−59.52×10−43131.30×10−43.00×10−43223.64×10−45.24×10−53341.20×10−39.52×10−63453.21×10−30


### 4.3. Key-Dependent Security

For any secure hashing algorithm, each different key results into a different hashing sequence; i.e., the probability of sequence collision is minimum. Figure8 illustrates the key security of the hash algorithm in this work. The x-axis represents the index of 1000 wrong keys, and the y-axis represents the Euclidean distance. It is evident from the figure that the minimum value of Euclidean distance and the average value of all error keys are 345.2521 and 376.8121, respectively. It is noticeable that both of these quantities are significantly greater than the threshold value of 322 as discussed above. The threshold is presented in the red line in Figure 8. This means that it is difficult for an attacker to generate the correct hash sequence without the correct key. Therefore, the hash algorithm proposed in this work satisfies the security requirements.Figure 8
The distance between hashes with the correct secret key and 1000 wrong secret keys.


### 4.4. Performance Comparison of Different Blocks, Different Mirror Flipping, and Different Components

In order to analyze the influence of the number of blocks on the performance of the algorithm, we use receiver operating characteristics (ROC) curve to compare the performance, which mainly includes robustness and discrimination. We set a series of different thresholds to obtain a series of false positive rate (PFPR) and the true positive rate (PTPR) in order to draw the ROC curve. The simulation results are presented in Figure 9. The abscissa represents the PFPR and ordinate represents the PTPR. The PFPR and PTPR are computed as follows:
(11)PFPR=n1N1,(12)PTPR=n2N2,where n1 represents the number of different image pairs misjudged as similar image pairs, n2 represents the number of similar image pairs correctly judged, and N1 and N2 denote the total number of different image pairs and similar image pairs, respectively. The horizontal axis represents the discrimination performance, while the vertical axis represents the robustness performance. The closer the ROC curve is to the upper left corner, the better is the performance of the proposed algorithm.Figure 9
(a) Original image. (b) Flipping along the vertical axis. (c) Flipping along the horizontal axis. (d) The ROC curves of different blocks, different mirror flipping, and different components.
(a)(b)(c)(d)In the simulations, we use 1000 images for discrimination test. According to the attack settings presented in Table4, we generate visually similar images. Each image is used to generate 20 similar images. Therefore, the total number of similar image pairs is 210,000, and the number of different image pairs is 499,500. When the image is divided into 8×8, 16×16, and 32×32 blocks, the resultant hash code length of the proposed algorithm is 100 decimal numbers, 452 decimal numbers, and 1924 decimal numbers, respectively. When the image is divided into 32×32 blocks, the resultant hash sequence length is too long. Therefore, in the simulations, we only evaluate the performance of hash algorithm whose image is divided into 8×8 blocks and image flipping along the vertical axis 16×16 blocks and image flipping along the vertical axis 16×16 blocks, but the algorithm does not add the image component after mirror flipping (NAF), flipping the up and down sides of the preprocessed image along the horizontal axis (UDH), and the image component L in the lab space is used to replace the brightness component Y. As presented in Figure 9, the ROC curve of the hash algorithm divided into 16×16 blocks is closer to the upper left corner than other hash algorithm. Thus, the performance of the former is better than the latter. In this work, the hash algorithm divides the image into 16×16 blocks and image flipping along the vertical axis, which is an effective choice for the balance between robustness and discrimination.


### 4.5. Performance Comparison of Different Parameters

In order to analyze the influence of the parameters on the performance of the proposed algorithm, we use ROC curve to compare the performance. This major component includes robustness and discrimination. A series of different thresholds are set to obtain a series ofPFPR and the PTPR. These computed parameters are then used to draw the ROC curve. The simulation results are presented in Figure 10. In Figure 10, the abscissa represents the PFPR and the ordinate represents the PTPR. The computations are performed by the mathematical relations presented in Equations (11) and (12).Figure 10
ROC curves of different parameters.In the experiment, we use 1000 images for performing discrimination tests. According to the attack situations presented in Table4, we generate visually similar images. Each image is used to generate 20 similar images. Therefore, the total number of similar image pairs is 210,000, and the number of different image pairs is 499,500. In this section, we discuss the influence on the performance of the algorithm when the parameter “d” takes different values, where “d” represents the distance from the origin of elements to the four angles of the diamond. In this section, we compare three pairs of parameters: d=“1,2”, d=“2,3”, and d=“3,4”, respectively. As presented in Figure 10, the ROC curve of the hash algorithm with a parameter set d=“1,2” is closer to the upper left corner as compared to the hash algorithm with parameter sets d=“2,3” and d=“3,4”. In this work, the hashing algorithm chooses to set the hyper pixel segmentation parameter d=“1,2”, which is a good choice to balance between robustness and discrimination.


### 4.6. Performance Comparison of Different Algorithms

We compare the performance of the image hashing algorithm proposed in this work with the previous works presented in literature, such as CVA-Canny algorithm [3], the Ring algorithm [5], TD algorithm [13], LP algorithm [14], and color structure algorithm [17]. The parameters of the comparison are equivalent to the parameter values selected in the respective published papers. As shown in Table 6, the hash length of the algorithm compared is 40 decimal numbers, 440 binary numbers, 96 binary numbers, 1024 decimal numbers, and 354 binary numbers, respectively. The hash code length of the proposed hash algorithm is 452 decimal numbers.Table 6
Comparison.
AlgorithmOur algorithmCVA-Canny [3]Ring [5]TD [13]LP [14]Color structure [17]Average time (s)0.0400.3040.2110.0980.0280.018Hash length452 decimal digits40 decimal digits440 bits96 bits1024 decimal digits354 bitsIn this simulation, the hash algorithm is used to extract the hash sequences of similar image pairs and different image pairs. The Euclidean distance between these image pairs is computed. The attack settings for similar images are also kept the same as presented in Table4. There are 210,000 similar image pairs and 499,500 different image pairs. A series of different thresholds are set to obtain a series of PFPR and the PTPR to draw the ROC curve. The simulation results are presented in Figure 11. It is evident that the curve of the proposed algorithm in this work is closer to the upper left corner than the ROC curves of other algorithms. This indicated that the classification ability of the proposed algorithm is better as compared to previous algorithms presented in literature.Figure 11
ROC curves of different algorithms.In this work, the luminance componentY is extracted and the color components RG and BY are partitioned for feature extraction. Therefore, the hash sequence length is relatively long. However, the average computation time of this algorithm is only longer than the color structure and LP algorithm, which is superior to the remaining comparison algorithms.


### 4.7. Tamper Detection Experiment

When a part of the image is tampered, the Euclidian distance between the tampered image and the hash sequence of the original image should be between the distance from the similar image and the distance from the different image. In order to verify the tamper detection capability of the proposed algorithm, we obtain 15,000 images from VOC2012 database [23]. Each image in the dataset is tampered to perform simulations. Figure 12 presents an example of a tampered image. The Euclidean distance distribution diagram of similar image pairs, tampered image pairs, and different image pairs is presented in Figure 13(a). The x-coordinate T1 at the intersection of similar image pairs and tampered image pairs is 136, and the x-coordinate T2 at the intersection point of tampered image pair and different image pair is 301. We select T1 and T2 as thresholds; when the distance between the detected image and the original image is less than T1, the target image is regarded to be similar, and when the distance between the image to be detected and the original image is greater than T1 and less than T2, the image is regarded as tampered image. When the distance between the image to be detected and the original image is greater than T2, the image to be detected is regarded as a different image. The simulation results show that the proposed algorithm has 80.26%, 96.37%, and 99.99% accuracy in judging similar images, tampered images, and different images, respectively. Figure 14 shows several pairs of contrast image pairs. Similarly, Table 7 shows the Euclidian distance and relationship between several pairs of contrast image pairs. The contrast image includes similar images, tampered images, and different images, and the relationship between the original image and the contrast image can be judged on the basis of Euclidean distance. It is evident that the relationship between the two images is accurately judged according to the Euclidean distance between the original image and the comparison image. This indicates that the algorithm presented in this work has good tampering detection performance.Figure 12
Original image and tampered image.Figure 13
(a) Hash distance distribution after adding mirror flipping. (b) Does not add mirror flipping’s hash distance distribution.
(a)(b)Figure 14
Original image and tampered image.Table 7
Comparison of the Euclidean distance and relationship between image pairs.
Image pairsa1 with b1a2 with b2a3 with b3a4 with b4a5 with b5a6 with b6a7 with b7Euclidean distance281.8571.76197.48410.76225.58279.51142.35Judge relationshipTamperSimilarTamperDifferentTamperTamperTamperJust to prove the advantage of mirror flipping, we present the performance of the algorithm with and without mirror flipping. The database used for this simulation is the same as above. In this work, mirror flipping is not performed in the step of “mirror flipping” in Figure1. The luminance components extracted from two identical images superimposed together, and the opposite color components are extracted from two identical images superimposed together for performing calculation. In this way, the variables are controlled and the comparison is more reliable. The distribution diagram is shown in Figure 13(b). The x-coordinate T1 at the intersection of similar image pairs and tampered image pairs is 111. The x-coordinate T2 at the intersection point of tampered image pair and different image pair is 310. We select T1 and T2 as thresholds. When the distance between the detected image and the original image is less than T1, the image to be detected is judged to be similar. When the distance between the image to be detected and the original image is greater than T1 and less than T2, the image to be detected is judged as tampered image. When the distance between the image to be detected and the original image is greater than T2, the image to be detected is judged to be different image. The simulation results have shown that the proposed algorithm has an accuracy of 72.34%, 96.60%, and 99.99% without adding mirror flipping in the case of similar images, tampered images, and different images, respectively.As shown in Table8, comparing algorithm with join mirror flipping that did not join the mirror rotating algorithm in recognition tamper or different images in accuracy is similar, but the recognition similar image accuracy of 72.34% is significantly less than the join mirror flipping to identify similar image accuracy of 80.26%, so this article chooses to mirror flipping algorithm.Table 8
Recognition accuracy rate.
AlgorithmAccuracy rate of similar imageAccuracy rate of tamper imageAccuracy rate of different imageMirror flipping80.26%96.37%99.99%Not mirror flipping72.34%96.60%99.99%


## 4.1. Robustness Experiment

In order to evaluate the robustness of the image hashing algorithm proposed in this work, we use 20 images as test samples. Figure5 represents one of the sample images. We also generate similar images for each test according to the type of attack as presented (Table 1); there are 59 attack samples for each image as test samples of similar images. We use the proposed algorithm to compute the hash sequence of the original image. Similarly, we also compute the hash sequence of a closely similar image. Then, we calculate the Euclidean distance between the two resultants. The Euclidean distance charts are drawn according to attack category. The simulation results for assessing robustness of the proposed algorithm are presented in Figure 6. It is evident from Figure 6 that the JPEG compression, brightness adjustment, contrast adjustment, salt and pepper noise, image scaling, watermark embedding, gamma correction, speckle, and Gaussian filtering have a small fluctuation range in the curve. The Euclidean distance in all cases is less than 165. In the simulations performed to test the algorithms robustness against the rotation attack, we observe that the distance of the rotation attack within 1° of image rotation is small. The distance of the rotation attack gradually increases with the increase in the angle. This is because the proposed algorithm blocks the image, thus making it more sensitive to the rotation attack. In Table 2, we present the statistical results of Euclidean distance for 20 images under different attacks. The presented cases include JPEG compression, brightness adjustment, contrast manipulation, salt and pepper noise, image scaling, watermark embedding, rotation, gamma correction, speckle, and Gaussian filtering. In Table 3, we give the average mean square error (MSE) and peak signal-to-noise ratio (PSNR) values between the original images of five test images and the images generated after the corresponding maximum parameter attack in each attack. For all these attacks, except rotation, the maximum Euclidean distance is less than 165 and the mean and variance are less than 88. The maximum and average Euclidean distance for rotation attack is 226 and 318. The results show that the maximum value of the Euclidean distance is 165 except the rotation attack. This indicates that the proposed algorithm is robust against all types of attacks except large angle rotation attacks, such as JPEG compression, brightness adjustment, contrast adjustment, and other attacks.Figure 5
Color image in robustness experiment.Table 1
Attack setting in robustness experiment.
OperationParameterParameter valuesJPEG compressionQuality30, 40,…,100Brightness adjustmentLevel-20, -10, 10, 20Contrast adjustmentLevel-20, -10, 10, 20Salt and pepperNoise level0.002, 0.004,…,0.01Image resizingRatio0.6, 0.8, 1.2, 1.4, 1.6, 1.83×3 Gaussian filterStandard deviation0.1, 0.2,…,1RotationAngle1, 2, 3,…,7, 8Watermark embeddingTransparency0.3–0.8Gamma correctionGamma0.75, 0.9, 1.1, 1.25SpeckleNoise variance0.002, 0.004,…,0.01Figure 6
Robustness experiment.
(a)
JPEG compression(b)
Brightness adjustment(c)
Contrast adjustment(d)
Salt and pepper(e)
Image resizing(f)
3×3 Gaussian low-pass filter(g)
Rotation(h)
Watermark embedding(i)
Gamma correction(j)
SpeckleTable 2
Euclidean distance in different attacks.
OperationMinMaxMeanSDJPEG5.131275.660932.240819.9104Brightness31.5577138.041761.433727.3783Contrast10.344391.649437.128722.6655Salt and pepper22.034189.751147.000017.1471Image resizing15.257286.300338.160318.6133Gaussian filter22.407254.293337.88139.3474Rotation66.5561317.5768225.617271.9825Watermark2.437733.465811.66419.6917Gamma45.7193164.703987.444132.2778Speckle17.879487.536548.709818.4361Table 3
Mean value of MSE and PSNR.
OperationParameter valuesMSEPSNRJPEG compression1002.756749.7483Brightness adjustment20260.321128.8134Contrast adjustment2011.399942.6260Salt and pepper0.01109.728932.5156Image resizing1.838.263438.61823×3 Gaussian filter183.916335.0653Rotation83805.817.1840Watermark embedding0.82.429149.6675Gamma correction1.25265.229828.7490Speckle0.01120.729832.2695


## 4.2. Discrimination Experiment

We download 1000 images from Ground Truth database [21] and VOC2007 database [22] for performing discrimination analysis of the proposed algorithm. The hash sequences of 1000 images are computed by using the algorithm proposed in this work. Then, we calculate the Euclidean distance between these 1000 images hash sequences. We generate a total of C10002=499,500 different image pairs. The similar image pairs are generated according to Table 4.Table 4
Operations and parameter setting in discrimination experiment.
OperationParameterParameter valuesJPEG compressionQuality factor4080Brightness adjustmentLevel2020Contrast adjustmentLevel2020Salt and pepperNoise level0.0020.006Image resizingRatio0.81.63×3 Gaussian filterStandard deviation0.20.6RotationAngle12Watermark embeddingTransparency0.30.8Gamma correctionGamma0.751.25SpeckleNoise variance0.0020.006Each downloaded image is used to generate 20 similar image pairs. The Euclidean distance between the similar generated images and the original image is calculated. There are21×20/2×1000=210000 pairs of similar images. The distribution of Euclidean distances for similar and different images is presented in Figure 7 for different Euclidean distances and ordinate for the different frequencies of Euclidean distance; find the minimum Euclidean distance between different images by a calculation value of 274.06, similar image on the maximum Euclidean distance of 344.96, and similar and different images of Euclidean distance intersection between 274.06 and 344.96. In order to obtain the optimal value for distinguishing similar image pairs from different image pairs in this work, we use collision rate and error detection rate to perform analysis. The collision rate and error detection rate are computed as follows:
(9)PC=NCND,(10)PE=NENS,where NC and ND represent the number of different image pairs detected as similar image pairs and the total number of different image pairs, respectively. Similarly, NE and NS represent the number of similar image pairs detected as different image pairs and the total number of similar image pairs, respectively. PC and PE represent the collision rate and error detection rate, respectively.Figure 7
The hash distance distribution of similar image pairs and different image pairs.The computation results are presented in Table5. The results presented in Table 5 reveal that the threshold value is 322, and at this point, the algorithm has a low collision rate and a low error detection rate, with good discrimination.Table 5
Threshold selection.
ThresholdCollision rateError detection rate27405.16×10−32864.00×10−62.45×10−33013.40×10−59.52×10−43131.30×10−43.00×10−43223.64×10−45.24×10−53341.20×10−39.52×10−63453.21×10−30


## 4.3. Key-Dependent Security

For any secure hashing algorithm, each different key results into a different hashing sequence; i.e., the probability of sequence collision is minimum. Figure8 illustrates the key security of the hash algorithm in this work. The x-axis represents the index of 1000 wrong keys, and the y-axis represents the Euclidean distance. It is evident from the figure that the minimum value of Euclidean distance and the average value of all error keys are 345.2521 and 376.8121, respectively. It is noticeable that both of these quantities are significantly greater than the threshold value of 322 as discussed above. The threshold is presented in the red line in Figure 8. This means that it is difficult for an attacker to generate the correct hash sequence without the correct key. Therefore, the hash algorithm proposed in this work satisfies the security requirements.Figure 8
The distance between hashes with the correct secret key and 1000 wrong secret keys.


## 4.4. Performance Comparison of Different Blocks, Different Mirror Flipping, and Different Components

In order to analyze the influence of the number of blocks on the performance of the algorithm, we use receiver operating characteristics (ROC) curve to compare the performance, which mainly includes robustness and discrimination. We set a series of different thresholds to obtain a series of false positive rate (PFPR) and the true positive rate (PTPR) in order to draw the ROC curve. The simulation results are presented in Figure 9. The abscissa represents the PFPR and ordinate represents the PTPR. The PFPR and PTPR are computed as follows:
(11)PFPR=n1N1,(12)PTPR=n2N2,where n1 represents the number of different image pairs misjudged as similar image pairs, n2 represents the number of similar image pairs correctly judged, and N1 and N2 denote the total number of different image pairs and similar image pairs, respectively. The horizontal axis represents the discrimination performance, while the vertical axis represents the robustness performance. The closer the ROC curve is to the upper left corner, the better is the performance of the proposed algorithm.Figure 9
(a) Original image. (b) Flipping along the vertical axis. (c) Flipping along the horizontal axis. (d) The ROC curves of different blocks, different mirror flipping, and different components.
(a)(b)(c)(d)In the simulations, we use 1000 images for discrimination test. According to the attack settings presented in Table4, we generate visually similar images. Each image is used to generate 20 similar images. Therefore, the total number of similar image pairs is 210,000, and the number of different image pairs is 499,500. When the image is divided into 8×8, 16×16, and 32×32 blocks, the resultant hash code length of the proposed algorithm is 100 decimal numbers, 452 decimal numbers, and 1924 decimal numbers, respectively. When the image is divided into 32×32 blocks, the resultant hash sequence length is too long. Therefore, in the simulations, we only evaluate the performance of hash algorithm whose image is divided into 8×8 blocks and image flipping along the vertical axis 16×16 blocks and image flipping along the vertical axis 16×16 blocks, but the algorithm does not add the image component after mirror flipping (NAF), flipping the up and down sides of the preprocessed image along the horizontal axis (UDH), and the image component L in the lab space is used to replace the brightness component Y. As presented in Figure 9, the ROC curve of the hash algorithm divided into 16×16 blocks is closer to the upper left corner than other hash algorithm. Thus, the performance of the former is better than the latter. In this work, the hash algorithm divides the image into 16×16 blocks and image flipping along the vertical axis, which is an effective choice for the balance between robustness and discrimination.


## 4.5. Performance Comparison of Different Parameters

In order to analyze the influence of the parameters on the performance of the proposed algorithm, we use ROC curve to compare the performance. This major component includes robustness and discrimination. A series of different thresholds are set to obtain a series ofPFPR and the PTPR. These computed parameters are then used to draw the ROC curve. The simulation results are presented in Figure 10. In Figure 10, the abscissa represents the PFPR and the ordinate represents the PTPR. The computations are performed by the mathematical relations presented in Equations (11) and (12).Figure 10
ROC curves of different parameters.In the experiment, we use 1000 images for performing discrimination tests. According to the attack situations presented in Table4, we generate visually similar images. Each image is used to generate 20 similar images. Therefore, the total number of similar image pairs is 210,000, and the number of different image pairs is 499,500. In this section, we discuss the influence on the performance of the algorithm when the parameter “d” takes different values, where “d” represents the distance from the origin of elements to the four angles of the diamond. In this section, we compare three pairs of parameters: d=“1,2”, d=“2,3”, and d=“3,4”, respectively. As presented in Figure 10, the ROC curve of the hash algorithm with a parameter set d=“1,2” is closer to the upper left corner as compared to the hash algorithm with parameter sets d=“2,3” and d=“3,4”. In this work, the hashing algorithm chooses to set the hyper pixel segmentation parameter d=“1,2”, which is a good choice to balance between robustness and discrimination.


## 4.6. Performance Comparison of Different Algorithms

We compare the performance of the image hashing algorithm proposed in this work with the previous works presented in literature, such as CVA-Canny algorithm [3], the Ring algorithm [5], TD algorithm [13], LP algorithm [14], and color structure algorithm [17]. The parameters of the comparison are equivalent to the parameter values selected in the respective published papers. As shown in Table 6, the hash length of the algorithm compared is 40 decimal numbers, 440 binary numbers, 96 binary numbers, 1024 decimal numbers, and 354 binary numbers, respectively. The hash code length of the proposed hash algorithm is 452 decimal numbers.Table 6
Comparison.
AlgorithmOur algorithmCVA-Canny [3]Ring [5]TD [13]LP [14]Color structure [17]Average time (s)0.0400.3040.2110.0980.0280.018Hash length452 decimal digits40 decimal digits440 bits96 bits1024 decimal digits354 bitsIn this simulation, the hash algorithm is used to extract the hash sequences of similar image pairs and different image pairs. The Euclidean distance between these image pairs is computed. The attack settings for similar images are also kept the same as presented in Table4. There are 210,000 similar image pairs and 499,500 different image pairs. A series of different thresholds are set to obtain a series of PFPR and the PTPR to draw the ROC curve. The simulation results are presented in Figure 11. It is evident that the curve of the proposed algorithm in this work is closer to the upper left corner than the ROC curves of other algorithms. This indicated that the classification ability of the proposed algorithm is better as compared to previous algorithms presented in literature.Figure 11
ROC curves of different algorithms.In this work, the luminance componentY is extracted and the color components RG and BY are partitioned for feature extraction. Therefore, the hash sequence length is relatively long. However, the average computation time of this algorithm is only longer than the color structure and LP algorithm, which is superior to the remaining comparison algorithms.


## 4.7. Tamper Detection Experiment

When a part of the image is tampered, the Euclidian distance between the tampered image and the hash sequence of the original image should be between the distance from the similar image and the distance from the different image. In order to verify the tamper detection capability of the proposed algorithm, we obtain 15,000 images from VOC2012 database [23]. Each image in the dataset is tampered to perform simulations. Figure 12 presents an example of a tampered image. The Euclidean distance distribution diagram of similar image pairs, tampered image pairs, and different image pairs is presented in Figure 13(a). The x-coordinate T1 at the intersection of similar image pairs and tampered image pairs is 136, and the x-coordinate T2 at the intersection point of tampered image pair and different image pair is 301. We select T1 and T2 as thresholds; when the distance between the detected image and the original image is less than T1, the target image is regarded to be similar, and when the distance between the image to be detected and the original image is greater than T1 and less than T2, the image is regarded as tampered image. When the distance between the image to be detected and the original image is greater than T2, the image to be detected is regarded as a different image. The simulation results show that the proposed algorithm has 80.26%, 96.37%, and 99.99% accuracy in judging similar images, tampered images, and different images, respectively. Figure 14 shows several pairs of contrast image pairs. Similarly, Table 7 shows the Euclidian distance and relationship between several pairs of contrast image pairs. The contrast image includes similar images, tampered images, and different images, and the relationship between the original image and the contrast image can be judged on the basis of Euclidean distance. It is evident that the relationship between the two images is accurately judged according to the Euclidean distance between the original image and the comparison image. This indicates that the algorithm presented in this work has good tampering detection performance.Figure 12
Original image and tampered image.Figure 13
(a) Hash distance distribution after adding mirror flipping. (b) Does not add mirror flipping’s hash distance distribution.
(a)(b)Figure 14
Original image and tampered image.Table 7
Comparison of the Euclidean distance and relationship between image pairs.
Image pairsa1 with b1a2 with b2a3 with b3a4 with b4a5 with b5a6 with b6a7 with b7Euclidean distance281.8571.76197.48410.76225.58279.51142.35Judge relationshipTamperSimilarTamperDifferentTamperTamperTamperJust to prove the advantage of mirror flipping, we present the performance of the algorithm with and without mirror flipping. The database used for this simulation is the same as above. In this work, mirror flipping is not performed in the step of “mirror flipping” in Figure1. The luminance components extracted from two identical images superimposed together, and the opposite color components are extracted from two identical images superimposed together for performing calculation. In this way, the variables are controlled and the comparison is more reliable. The distribution diagram is shown in Figure 13(b). The x-coordinate T1 at the intersection of similar image pairs and tampered image pairs is 111. The x-coordinate T2 at the intersection point of tampered image pair and different image pair is 310. We select T1 and T2 as thresholds. When the distance between the detected image and the original image is less than T1, the image to be detected is judged to be similar. When the distance between the image to be detected and the original image is greater than T1 and less than T2, the image to be detected is judged as tampered image. When the distance between the image to be detected and the original image is greater than T2, the image to be detected is judged to be different image. The simulation results have shown that the proposed algorithm has an accuracy of 72.34%, 96.60%, and 99.99% without adding mirror flipping in the case of similar images, tampered images, and different images, respectively.As shown in Table8, comparing algorithm with join mirror flipping that did not join the mirror rotating algorithm in recognition tamper or different images in accuracy is similar, but the recognition similar image accuracy of 72.34% is significantly less than the join mirror flipping to identify similar image accuracy of 80.26%, so this article chooses to mirror flipping algorithm.Table 8
Recognition accuracy rate.
AlgorithmAccuracy rate of similar imageAccuracy rate of tamper imageAccuracy rate of different imageMirror flipping80.26%96.37%99.99%Not mirror flipping72.34%96.60%99.99%


## 5. Conclusions

This work proposes an image hashing algorithm based on mirror flipping and space angle. The new luminance component and the opposite color component are obtained by mirror flipping. We extract the morphological features by the new luminance component. In addition, the space angle features are also extracted by the new opposite color component. Finally, the hash sequence is obtained by combining the morphological and space angle features. Simulation results show that the proposed algorithm is robust against brightness attack, contrast attack, and other attacks. The ROC curve shows that the algorithm presented in this work has better image classification performance than the previous algorithms proposed in literature. In addition, the proposed algorithm has good key security and good detection accuracy of tampered images.But the algorithm in this paper has poor robustness to large angle rotation and can only detect a large range of tampering for the time being. So, our future work will focus on how to improve robustness to large angle rotations, reduce the storage space of hash sequence, and locate tampering region.



---

*Source: 5349672-2021-09-28.xml*