1 Introduction

Image hashing technique is a useful tool used in protecting the content of color images. The available image editing tools such as PhotoScape, Adobe Photoshop and Photopad could be used to manipulate and alter the content of the color images. In addition to the image authentication, robust image hashing could be utilized in detecting image forgery and tampering. Traditional hash techniques such as SHA-1 and MD-5 [12] are sensitive to very small changes in the image. Therefore, these techniques are not suitable for image authentication. This drawback makes these techniques unsuitable for image authentication. Robust image hashing provides a short sequence from image and can tolerate content-preserving modifications [18]. Previous studies refer to the role of robust image hashing for image authentication. There are two types of image hashing methods. The first type is devoted to gray images or one channel of color images such as a luminance, while the second one handles the color images.

Swaminathan et al. [19] constructed a new method that used Fourier transform. Experimental results showed that this method has good capabilities and is flexible to different operations. Unfortunately, this method could not preserve the content of the image. Monga and Mihcak [14] used nonnegative matrix factorization (NMF) for image hashing. Ahmed et al. [1] presented a new wavelet-based image authentication method. This method could not achieve the robustness against geometric attacks. Zhao et al. [25] utilized the corrected phases of Zernike moments and the rotation invariants to construct an image hash. This method is robust against most content-preserving attacks and has low collision probability.

Weng and Preneel [23] proposed a new image hashing algorithm for image content authentication. They divided the image into blocks and extract the features of each block using the coefficients of the discrete Fourier transform (DFT). This method achieved a marginal success in securing the content of image blocks. Lei et al. [13] constructed a robust image hash where the features of the image were extracted using the Radon transform. Their results showed robustness against JPEG compression, blur and noise attacks. Zhao [24] used the magnitudes of Zernike moments to construct the image hash. This method improved the robustness against attacks. Unfortunately, the hash is sensitive to filtering. Qin et al. [17] presented a robust image hashing scheme using a non-uniform sampling in the discrete Fourier domain. Their results showed low probability and robustness against content-preserving manipulations.

Tang et al. [21] used the coefficients of the dominant discrete cosine transform (DCT) to construct the image hash where their results showed robustness against different attacks. Chen et al. [2] proposed a robust image hashing scheme using invariants of Tchebichef moments. The random gray code was applied to enhance the expected discriminability. Their results showed robustness against content-preserving manipulations. Tang et al. [20] proposed a perceptual hash for color images. This hash was constructed by computing the invariant moments of Hu for each channel and concatenating them where the L2 norm was used to evaluate the similarity between image hashes. Since Hu moment invariants are not accurate, this method could not achieve the desirable robustness against different attacks. All aforementioned methods were used to construct image hash for gray or single channel color images.

On the other side, Ghouti [4] utilized the quaternion singular value decomposition (QSVD) to construct the perceptual hash for color images. Ouyang et al. [15] proposed a new hash for color images. They used quaternion discrete Fourier transform to extract features of the image. To achieve the rotation invariance, they utilized the log polar transform. This method is relatively robust against the popular content-preserving operations. Ouyang et al. [16] proposed a new hash for authenticating color images. They used the quaternion Zernike moments (QZMs) to extract the features of the color images. In their work, Ouyang and his co-authors utilized the Zero-approximation method to calculate the Zernike moments which results in a set of inaccurate features and inaccurate scaling and rotation moment invariants. In addition to this significant weakness point, the extracted features by Zernike moments are sensitive to different kinds of noises. Unfortunately, none of the aforementioned hashing methods achieve the optimal image hash. This shortage motivates the authors to propose a new method to construct a robust image hash for color image authenticate.

In the proposed method, a robust image hash is constructed where the highly accurate and fast QPCET moments and their rotations, scaling and translation invariants are used to extract highly accurate features from color images. The Euclidean distance is used to measure the similarity between the image hashes. Experimental results clearly show that the proposed method is robust against the scaling and rotation attacks with different scaling factors and a wide range of rotation angles. Also, it is robust against the common signal processing attacks such as salt and peppers noise, white Gaussian noise, speckle noise, JPEG compression, average filtering, brightness and contrast adjustment with different parameters. A set of numerical experiments is performed to test the validity of the proposed method. A comparison with the existing methods, Ghouti [4] and Ouyang et al. [16], ensures the superiority of the proposed method.

The rest of the paper is organized as follows: A detailed description of the proposed scheme is presented in Sect. 2. The process of image authentication is presented in Sect. 3. The description of the conducted numerical experiments and the analysis of the obtained results are presented in Sect. 4. The conclusion of this work is presented in Sect. 5.

2 Proposed Hashing Scheme

The proposed method is divided into three main steps as illustrated in Fig. 1. Each step will be described in a separate subsection. The first subsection is devoted to the image preprocessing step. The detailed process of extracting the features is presented in the second subsection. Finally, the process of hash construction is presented in the third subsection.

Fig. 1
figure 1

Proposed image hashing scheme

2.1 Image Preprocessing

The preprocessing of the color images is performed through two successive steps. Firstly, the input color image is rescaled to a fixed size \( M \times M \) using bicubic interpolation. This resizing process aims to unifying the size of hashes of all images. Secondly, the rescaled color image is filtered. In this process, the rescaled color image is filtered by the Gaussian low-pass filter to improve the robustness of the extracted features against noise and decrease the high frequency components. The size of the kernel/window of the Gaussian low-pass filter must increase with increasing the value of the standard deviation, σ, to maintain the Gaussian nature of the filter. Three different windows are tested, 3 × 3 with σ = 1; 5 × 5 with σ = 3 and 7 × 7 with σ = 5. The obtained results are close to each other. The window size 3 × 3 with standard deviation σ = 1 will be used in the performed experiments.

2.2 Feature Extraction

Highly accurate QPCET moments are computed for the input color image to extract highly accurate features. These accurate features are the cornerstone in constructing the robust image hash. Quaternion representation of color images and the QPCET moments are discussed in the following subsections.

2.2.1 Quaternion of Color Image

Hamilton [5] introduced the quaternion as a generalized mathematical complex number. A quaternion consists of one real part and three imaginary parts. It can be expressed as follows:

$$ q = w + xi + yj + zk $$
(1)

where \( w, \;x, \;y \) and \( z \) are real numbers, and i, j and \( k \) are three imaginary units which are defined according to the following equations:

$$ \begin{aligned} i^{2} & = j^{2} = k^{2} = - \;1 \\ i & = jk = - \;kj \\ j & = ki = - \;ik \\ k & = ij = - \;ji \\ \end{aligned} $$
(2)

If the real part \( w = 0 \), \( q \) is called a pure quaternion. The conjugate \( q^{*} \) and modulus of a quaternion \( \left| q \right| \) are defined as follows:

$$ q^{*} = w - xi - yj - zk,\;\;\;\;\;\left| q \right| = \sqrt {w^{2} + x^{2} + y^{2} + z^{2} } $$
(3)

A color image with the image intensity function \( f\left( {x,y} \right) \) could be represented as an array of pure quaternions [22] as follows:

$$ f\left( {x,y} \right) = f_{\text{R}} \left( {x,y} \right)i + f_{\text{G}} \left( {x,y} \right)j + f_{\text{B}} \left( {x,y} \right)k $$
(4)

where \( f_{\text{R}} \left( {x,y} \right), f_{\text{G}} \left( {x,y} \right), f_{\text{B}} \left( {x,y} \right) \) represent the red-, green- and blue-channels, respectively.

2.2.2 QPCET Moments

The right-side QPCET moments of order p and repetition q for the RGB color image with image intensity \( f\left( {r,\theta } \right) \) are defined in the polar coordinates over a unit circle as follows [22]:

$$ \varPhi_{pq} = \frac{1}{\pi }\mathop \smallint \limits_{0}^{2\pi } \mathop \smallint \limits_{0}^{1} f\left( {r,\theta } \right)\exp \left( { - \mu 2\pi pr^{2} } \right)\exp \left( { - \mu q\theta } \right)r{\text{d}}r{\text{d}}\theta $$
(5)

where \( \mu = \left( {i + j + k} \right)/\sqrt 3 \) is called a unit pure quaternion. Hosny and Darwish [8] introduced a novel highly accurate, fast and numerically stable method for computing the QPCET moments. This method is summarized using the following equations.

$$ \varPhi_{pq} = \frac{1}{\pi } \mathop \sum \limits_{i} \mathop \sum \limits_{j} \hat{f}\left( {r_{i} ,\theta_{i,j} } \right)D_{pq} \left( {r_{i} ,\theta_{i,j} } \right) $$
(6)

where

$$ D_{pq} \left( {r_{i} ,\theta_{i,j} } \right) = K_{p} \left( {r_{i} } \right) L_{q} \left( {\theta_{i,j} } \right) $$
(7)
$$ K_{p} \left( {r_{i} } \right) = \mathop \smallint \limits_{{U_{i} }}^{{U_{i + 1} }} {\text{e}}^{{ - \mu 2\pi pr^{2} }} r{\text{d}}r $$
(8)
$$ L_{q} \left( {\theta_{i,j} } \right) = \mathop \smallint \limits_{{U_{i} }}^{{V_{i,j + 1} }} {\text{e}}^{ - \mu q\theta } {\text{d}}\theta $$
(9)

Since the QPCET moments are defined and computed in the polar coordinates, the image intensity function in Cartesian coordinates, \( f\left( {x,y} \right) \), must be mapped to polar coordinates. All details of this process are presented in [6, 9]. The function \( \hat{f}\left( {r_{i} ,\theta_{i,j} } \right) \) represents the discrete color image in polar coordinates.

2.3 Hash Construction

The magnitude values of the computed QPCET moments represent the extracted features which are stored in a vector E. For a maximum order \( n = 5 \), the total number of features is 21 elements. Therefore, the hash length is 21 × 8 = 168 bits. Optimal image hashing must achieve two criteria, robustness and security. An image hashing is said to be robust, when using the same secret key between the sender and the receiver, the similar images must produce the similar hash [19]. To enhance the security, the image hash is scrambled by using a secret key, K. The secret key is randomly generated and represented in a vector. The similarity between image hashes is measured by the Euclidean distance [7]:

$$ d\left( {h_{1} ,h_{2} } \right) = \sqrt {\mathop \sum \limits_{l = 1}^{L} \left( {E_{1} \left( l \right) - E_{2} \left( l \right)} \right)^{2} } $$
(10)

where \( h_{1} \) and \( h_{2} \) are two image hashes and \( L \) is the length of hash vector.

3 Image Authentication

Robust image hashing is one of the techniques for image authentication [12]. Robust image hashing is the target of this paper. At the sender’s side, the preprocessing operations are applied to the input color image, and then QPCET moments are computed. The extracted features are sorted in a 1D vector called ‘the hash vector’ which is attached with the image to be sent. A secret key is utilized to encrypt the hash value before executing the sending operation. At the receiver side, the received hash is decrypted using the same secrete key and generates the hash from the received image in same way as the sender did. Finally, the generated hash and the attached one are compared to determine the image authenticity. An illustration of the main steps of image authentication is displayed in Fig. 2. A threshold value, \( T \), is used to decide whether the two images are similar or not. If hash distance value \( d \) is smaller than the threshold, \( T \), then the two images are similar. Otherwise, the two images are different.

Fig. 2
figure 2

Image authentication scheme

4 Numerical Results

To evaluate the performance of the proposed method, 660 original TIF format color images of size \( 786 \times 576 \) from different datasets [11] were used. The first dataset contains color images of flowers, while the second dataset contains a man-made color images. The third dataset contains color images of animals. In the performed experiments, 143, 418 and 99 color images are selected randomly from the first, second and the third datasets, respectively. Samples from these color images are displayed in Fig. 3. In all experiments, the following parameters are defined as follows: The size of normalized image M = 256; the order of QPCET moments is L = 5 (numbers of moments are 21) where the hash length of the proposed method is 21 × 8 = 168 bits. The robustness of the hash is tested against content-preserving attacks such as rotation, scaling, salt and peppers noise, speckle noise, white Gaussian noise, JPEG compression, average filter, brightness and contrast adjustment.

Fig. 3
figure 3

Samples of different color images from flowers, man-made and animals datasets [11] (Color figure online)

To ensure the validity of the proposed method, robustness tests and uniqueness hash test have been performed and the obtained results are shown in Sect. 4.2. To ensure the superiority of the proposed method, ROC curves [3] are used in comparing the proposed method with the existing methods, QSVD [4] and QZM [16]. The comparison between different methods is presented in Sect. 4.3.

4.1 Robustness Test

In the conducted experiments, 660 color images are used where each color image is attacked by 43 attacks. The attacks and the different values of the parameters are shown in Table 1. After that, the similarity between the original and attacked images is measured using the Euclidean distance. It is concluded that the total numbers of identical image pairs are 660 × 43 = 28,380. Figure 4 illustrates the probability distribution of identical images. It is observed that most preserving operations are less than threshold, \( T \), value equal to 3 and only few image pairs which exceed this threshold. Additional experiment is performed using 4 standard color images, ‘F16,’ ‘Lena,’ ‘Mandrill’ and ‘Pepper’ which selected from the dataset [10]. These images as displayed in Fig. 5 are used in testing the robustness against different attacks. The proposed method is applied to these standard color images where the obtained results are plotted and displayed in separate figures.

Table 1 Parameters used in the robustness experiment
Fig. 4
figure 4

Probability distributions of identical images

Fig. 5
figure 5

Standard color images (Color figure online)

The robustness of the hash against the average filter and the JPEG compression are displayed in Fig. 6a and b, respectively. It is observed that the values of the hash distances for average filter with common small window size, \( 3 \times 3 \) and \( 5 \times 5 \), are very small and these values slightly increased as the window size increased such as \( 7 \times 7 \), \( 9 \times 9 \) and \( 11 \times 11 \). For the JPEG compression attack, very small values of the hash distances are obtained with high-quality factors.

Fig. 6
figure 6

Robustness performances for average filter and JEPG compression, a average filter, b JPEG compression

The hash distances for contrast and brightness adjustments are displayed in Fig. 7a and b, respectively. The results in these figures show that the two attacks produce very small values for the hash distance where these values do not override 0.04 which ensure the robustness of the proposed method against both attacks.

Fig. 7
figure 7

Robustness performances for contrast and brightness adjustment, a contrast adjustment, b brightness adjustment

Scaling factors < 1 refer to image reduction, while scaling factors > 1 refer to image magnification. The hash distances are computed for scaling factors ranging from 0.4 to 2.2 with constant step 0.2 and counterclockwise rotation angles ranging from 0° to 210° with constant angle increment equal to 30°. The hash distances for rotation and scaling with different parameters are displayed in Fig. 8a and b, respectively. It is clear that very small values of the hash distances are obtained for scaling factors > 1 and acute rotation angles.

Fig. 8
figure 8

Rotation and scaling hash distances. a Rotation, b scaling

The robustness against common noises such as Gaussian noise, salt and pepper noise and speckle noise with different level of contamination is evaluated and displayed in Fig. 9a, b and c, respectively. The values of the hash distances for all geometric and signal processing attacks slightly change along the change of the parameters. Generally, in all cases, the values of the hash distances are not exceeding the specified value of the threshold \( T \) which ensures the robustness of the hash constructed by the proposed method against all geometric and signal processing attacks.

Fig. 9
figure 9

Robustness for some noise a Gaussian noise, b salt and pepper noise, c speckle noise

In image authentication using a hash distance, two color images are considered different when the hash distance is higher than the value of the threshold, \( T \left[ 1 \right] \). Based on the obtained results, some statistical calculations are performed using the different hash distances of the proposed method for the 43 different attacks. The average hash distance for each one of the nine attacks, average filter, JPEG compression, contrast adjustment, brightness adjustment, scaling, rotation, white Gaussian noise, salt and peppers noise and speckle noise, are shown in Table 2. None of the statistical average values exceeded the value of the threshold. These results ensure the robustness of the proposed hashing method against all kind of attacks. Also, these results are consistence with the probability distribution of identical images as displayed in Fig. 4 which ensure that \( T = 3 \) is the best choice to judge the similarity.

Table 2 Statistics of hash distances for the proposed method

4.2 Uniqueness Hash

If the hash sequences of dissimilar images are distinct, this means that the hash is unique. We download 300 images from man-made dataset [11] to form different images database. Figure 10 clarifies that the Euclidean distance probability distributions that computed from the relation \( C_{300}^{2} = 88450 \) hash pairs with 300 different images. Overall, we observed that the hashing distance of most different image pairs is more than \( T = 3 \). If two dissimilar images have identical hash values with the Euclidean distance less than T value, this can be called probability of collision (\( P_{\text{C}} \)) [26]. \( P_{\text{C}} \) can be calculated using Eq. 11. Thereby, these results prove the uniqueness and robustness of the proposed hashing method.

$$ P_{\text{C}} = \frac{\text{Number of different images judged as similar images}}{\text{Total number of different images}} $$
(11)
Fig. 10
figure 10

Probability distribution of different image hashing

4.3 Performance Comparisons

The performance of the proposed hashing method is compared with the existing methods, QSVD-based method of Ghouti [4] and the QZM-based method of Ouyang et al. [16]. For fair and accurate comparison, the same color images from the dataset in [11] are used in the comparison. The receiver operating characteristics (ROC) is a good and reliable qualitative measure. The ROC curves [3] are used for visualizing the classification performances. For fair comparison, the ROC curve is computed and plotted for each attack using the method of Ghouti [4], the method of Ouyang et al. [16] and the proposed method. The true positive rate (TP rate) and the false positive rate (FP rate) of the two compared methods are defined as follows:

$$ {\text{TP rate}} = \frac{x}{X} $$
$$ {\text{FP rate}} = \frac{y}{Y} $$

where \( x \) is number of the pairs of identical images considered as similar images, \( X \) is the total pairs of identical images, \( y \) is number of the pairs of different images considered as similar images, and \( Y \) is number of the total pairs of different images. To compute ROC curve for each method, different thresholds are selected in order to compare the proposed, Ghouti [4] and Ouyang et al. [16] methods. Different values of the thresholds are selected to be close to the specific threshold of each method. For the proposed method, the specific threshold is 3, so the selected values are 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3 and 4. For the method of Ghouti [4], the specific threshold is 200, so the selected values are 10, 40, 50, 70, 100, 120, 150, 200, 250, 300, 350 and 400. Finally, the specific threshold Ouyang et al. [16] is 12, so the selected values are 0.4, 0.6, 0.8, 1, 3, 6, 10, 12, 15, 20, 30 and 40.

The ROC curves for the average filter and JPEG compression are presented in Fig. 11a and b, respectively. It is observed that the proposed method is much robust to average filter and JPEG compression attacks.

Fig. 11
figure 11

ROC curve for an average filter and JPEG compression respectively, a average filter, b JPEG compression

The ROC curve for the contrast adjustment attack is displayed in Fig. 12a. It is clear that, the proposed method is perfect where it reached to 1 by a small false positive rate. On the other hand, the method of Ghouti [4] is sensitive to contrast adjustment, while the performance of the method of Ouyang et al. [16] is extremely bad. The ROC curve for the brightness adjustment attack is displayed in Fig. 12b. The performance of the proposed method is much better than the performance of the other methods [4] and [16].

Fig. 12
figure 12

ROC curve for a contrast adjustment, b brightness adjustment

For geometric attacks, the ROC curves for the rotation and scaling attacks are displayed in Fig. 13a and b, respectively. These figures clearly show that the proposed method is robust against rotation and scaling attacks due to the high accuracy of the QPCET moments. The method of Ghouti [4] is highly sensitive to rotation and scaling attacks.

Fig. 13
figure 13

ROC curve for geometric attacks a rotation, b scaling

Speckle noise is very important in medical images so we need to test the robustness against this noise. Robust to this kind of noise is very attractive characteristics. Despite the importance of this attack in the field of images, it was not applied before by Ghouti [4] and Ouyang et al. [16]. Therefore, in the current work we used this attack. Figure 14a, b and c shows ROC curves of some attacks related to noise such as Gaussian noise, salt and pepper and speckle noise.

Fig. 14
figure 14

ROC curve for a Gaussian noise, b salt and pepper noise, c speckle noise

The obtained results confirm the robustness of the proposed method. On the other side, the method of Ghouti [4] is sensitive to the three kinds of noises. The method of Ouyang et al. [16] is very sensitive, and its performance is very bad. Finally, Fig. 15 shows a ROC curve for general comparison between a proposed method, Ghouti [4] and Ouyang et al. [16]. All plotted ROC curves show that the proposed method achieved the best performance where the true positive rate is very close to 1 for all attacks.

Fig. 15
figure 15

ROC curve between a proposed, Ghouti [4] and Ouyang et al. [16]

The robustness to different attacks could be evaluated quantitatively. Additional set of experiments is performed where the Euclidean distance is used as an explicit quantitative measure. The 4 standard color images are attacked by the nine attacks with few different parameters. The comparison between the proposed method and the existing methods [4] and [16] is performed using hash distance values. For different values of the threshold, T, of each method the hash distance is tested and determined if this value is less than the threshold or not. The method is robust if the hash distance is less than the threshold, T, otherwise the method is not robust.

The threshold of the proposed method, \( T = 3 \), the hash distance for all attacks is less than \( T \). So, the robustness is achieved against all attacks. For a threshold, \( T = 200 \), the method of Ghouti [4] failed in the test of rotation and contrast adjustment attacks. For a threshold, \( T = 12 \), the method of Ouyang et al. [16] failed in the test of contrast and brightness adjustments attacks.

The obtained results of hash distance for different attacks as shown in Table 3 are consistent with the previously obtained results and confirm the robustness of the proposed method. Overall, it is clear that the proposed QPCET-based hashing method is robust against different attacks with different parameters. Moreover, the proposed QPCET-based hashing method is anti-collision and short hash length.

Table 3 Comparison between hash distance results using the proposed method, the methods of Ghouti [4] and the method of Ouyang et al. [16]

5 Conclusion

In this work, a new method for color image hashing is proposed. The utilization of the QPCET moments achieves three contributions. First, the QPCET moments are used to extract highly accurate features of the input color image and then construct a highly accurate hash values. Second, the QPCET rotation and scaling moment invariants are highly accurate which protect the constructed hash from the rotational and scaling attacks. Third, the QPCET moments are robust to different types of noises.

The input color images are attacked by nine, rotation, scaling, JPEG compression, average filter, contrast and Brightness adjustment, speckle noise, salt and peppers noise, and Gaussian noise, attacks with different parameters. The QPCET moments are used to extract the features of the original and attacked images, and then, the hash values are computed. The obtained results are tested by using quantitative and qualitative approaches where these results clearly show the robustness of the proposed method. The proposed method achieves the uniqueness of the hash by achieving a very low collision probability. Therefore, it is concluded that the proposed method is suitable for color image authentication.