Keywords

1 Introduction

In this era of Internet and smartphones, an enormous amount of data, especially images are produced. Thus, it has become a challenge for us to store and circulate image securely over the Internet. Hence, the two important factors are considered.

  1. (1)

    Image compression—It means to reduce the size of an image without degrading the image quality. This allows us to store images in limited disk or memory space. It is also useful in transmitting the image in low bandwidth. For instance, normally the pictures of size 15 MB from the smartphones are taken with an Internet speed of 64 k bit/s. It would take one hour to transfer but on applying image compression, it can be done in few minutes. The basic steps for image compression include transformation, followed by quantization and entropy coding (Fig. 1).

    Fig. 1
    figure 1

    Image compression process

The most frequently used transformations in digital image processing are discrete Fourier transform (DFT), discrete cosine transform (DCT), and discrete wavelet transform (DWT). DCT is basic in many lossy image compression methods. The image is divided into 8 × 8 blocks and then, DCT is performed. The motive of DCT is to assemble energy in terms of a sum of sinusoids with different frequencies and amplitudes. However, image compression algorithms based on DWT are highly efficient and diminish blocking artifacts [1]. In DWT, images are divided into sub-bands (LL, HL, LH, HH) by using wavelet filters [2]. The classic compression standard, i.e., JPEG 2000 is based on DWT while old JPEG is based on DCT. After transformation, quantization is applied. There are several quantization methods like embedded zerotree of wavelet (EZW), SPIHT, etc. The SPIHT coder is an efficient and fast algorithm for image compression [3]. In the final step of entropy coding, the output of the SPIHT algorithm is combined with Arithmetic, Huffman Coding, etc.

  1. (2)

    Image encryption—The process using encryption algorithms to convert an image into a secret image so that unauthorized user can’t access it (Fig. 2).

    Fig. 2
    figure 2

    Image encryption process

From security point of view, few suggested the direct transmission of an encrypted image without compression, but it requires a lot of bandwidth. Other proposed algorithms which compress the image in the first step and then encrypt the image in the second step, but it needs more time to execute. However, very few proposed the encryption of image before the compression. While some suggested novel methods have a joint image compression and encryption process.

2 Study on DWT and SPIHT

  1. (1)

    Discrete wavelet transform (DWT): The wavelet transform is practically used in image and signal processing. The Joint Photographic Experts Group (JPEG) has unleashed its new image compression standard, i.e., JPEG 2000, which is based upon DWT. This transform break signals into set of basis functions, called wavelets and which are obtained from mother wavelets [4]. DWT has various transforms such as Haar wavelet, Daubechies wavelets, Biorthogonal wavelets, and Meyer wavelet. In this process, image is analyzed by passing through filter banks at each decomposition stage. A 2D transform takes place by performing two isolated 1D transforms. In first stage, image is filtered along x-dimension, then sub-image along y-dimension. Finally, the input image is splitted into four sub-bands [1, 5]. The four sub-bands, i.e., LL, LH, HL, and HH images which contain all the information in the original image. The LL sub-band has the significant information called approximation sub-band of the original image. The LH, HL, HH has vertical, horizontal, and diagonal information of the original image, respectively (Fig. 3).

    Fig. 3
    figure 3

    Two-level decomposition

  2. (2)

    Set partitioning in hierarchical trees (SPIHT): It is the improved version of embedded zerotree wavelet (EZW) algorithm [6]. It is wavelet based on image encoding technique [7]. It is suitable for both lossy as well as lossless image compression [3].

For each coordinate value, there is a significance test function to valuate the significance. Let, t be a coordinate on which significance has to be checked and n is the integer value, then the significance test function is Sn(t).

$$\begin{array}{*{20}l} & {\text{If}(\max\left( {i,j} \right)\{ |c_{i,j} |\} \ge 2^{n} )} \\ & \quad \quad\quad{S_{n} \left( t \right) = 1} \\ & \text{else} \\ & \quad \quad\quad {S_{n} \left( t \right) = 0} \\ \end{array}$$

where ci,j defines the coefficient value at location (i, j). If Sn(t) = 1, then coordinate t is said to be significant at the threshold value T = 2n otherwise, insignificant [3].

This algorithm has three lists to store information namely, list of insignificant pixels (LIP), list of significant pixels (LSP), list of insignificant sets (LIS). All the entries in the list are identified by the pixel value (i, j) (Fig. 4).

Fig. 4
figure 4

Flowchart of SPIHT

Algorithm:

  1. 1.

    Input image.

  2. 2.

    Perform transformation using DWT.

  3. 3.

    Initialization of LSP, LIP, LIS using significant test where threshold value T = 2n and n is given by:

    $${\text{n}} = \lfloor\log_{2} \left( {{\max} \left( {{\text{i}},{\text{j}}} \right)\{ |{\text{c}}_{{{\text{i}},{\text{j}}}} |\} } \right)\rfloor.$$
  4. 4.

    Output n sent this output value to the decoder.

  5. 5.

    Output μn and sign of each μn pixel coordinates the such that 2n ≦ |cη(k)| ≦ 2n+1 (Sorting Pass).

  6. 6.

    Output the nth most significant bit of all the coefficients with |ci,j| ≧ 2n+1 (i.e., those coordinates were transmitted in the past go), in a similar request used to send the pixel coordinates (Refinement Pass).

  7. 7.

    n = n-1 (Quantization-step Update), and go to (Step 2).

3 Proposed Algorithm

The approach, “Joint image compression & encryption based on SPIHT algorithm & 3D chaotic map” is grounded on wavelet transformation, SPIHT algorithm, bitwise encryption and permutation of the output bitstream using chaotic secure system. It is a fast algorithm for an image compression and encryption process. The proposed method has good PSNR ratio which is required for proper reconstruction of the image (Fig. 5).

Fig. 5
figure 5

Flowchart of proposed algorithm

Proposed Algorithm:

  1. 1.

    Input image.

  2. 2.

    Apply DWT on the input image.

  3. 3.

    Perform secure SPIHT for joint image compression and partial encryption process.

  4. 4.

    Bitwise encryption on output bitstream of secure SPIHT encoding.

  5. 5.

    Permutation.

  6. 6.

    Compressed and encrypted output.

  1. (1)

    Chaotic System: The simplest way of chaos generation is defined by the logistic map. The equation for the logistic map is given by:

$$X_{n + 1} = \mu X_{n} (1 - X_{n} )$$

0 < Xn < 1 and µ = 4 are the basic conditions to make the chaotic equation [8]. Hongjuan Liu gives us the 2D logistic map employing quadratic coupling for security enhancing and it is upgraded to 3D version, which is given by the following equations:

$$\begin{aligned} X_{n + 1} & = \gamma X_{n} (1 - X_{n} ) + \beta Y_{{n^{2} }} X_{n} + \alpha Z_{{n^{3} }} \\ Y_{n + 1} & = \gamma Y_{n} (1 - Y_{n} ) + \beta Z_{{n^{2} }} Y_{n} + \alpha X_{{n^{3} }} \\ Z_{n + 1} & = \gamma Z_{n} (1 - Z_{n} ) + \beta X_{{n^{2} }} Z_{n} + \alpha Y_{{n^{3} }}\end{aligned}$$

where 3.53 < γ < 3.81, 0 < β < 0.022, and 0 < α < 0.015. The initial input values of the X, Y, and Z are lying between zero and one. The secure chaotic system is hypersensitive to the initial conditions. The two very close initial values will never follow the same path [9].

Figure 6 shows the generated chaotic sequence for the initial values X(1) = 0.235, Y(1) = 0.350, Z(1) = 0.735, α(1) = 0.0125, β(1) = 0.0157, γ (1) = 3.7700 [10].

Fig. 6
figure 6

3D chaotic sequence

  1. (2)

    Secure SPIHT: This process encapsulated the encryption in the SPIHT algorithm to enhance the security. The data is not only compressed but also encrypted, which will enhance the cryptographic property of the bitstream. For each coefficient, there is a need to check if its value is greater than threshold (T) value, where T = 2n and n is obtained by

    $${\lfloor {n}} = \log_{2} \left( {{\max} (i,j)\{ |c_{i,j} |\} } \right)\rfloor.$$

In this case, the output is 1 else the output is 0. These output bits are encrypted using the key value [11].

Modified LIP sorting pass process is shown below.

figure a

Encryption of LIP sorting pass at encoder end.

figure b

Decryption of LIP sorting pass at decoder end.

  1. (3)

    Bitwise Encryption: This process encrypts the output bitstream of secure SPIHT algorithm. Encryption process is based on the key value. The number of key values depends on the number of compressed code stream generated from the secure SPIHT. In this process, the initial four bitstreams are ignored as they carry the important information to the decoder, which includes T value, number of rows, columns, and levels [6] (Fig. 7).

    Fig. 7
    figure 7

    Bitwise encryption of code stream

  2. (4)

    Permutation: For the last stage of security enhancement, this step permutates the encrypted output to give new location based on the chaotic sequence [12] (Fig. 8).

    Fig. 8
    figure 8

    Permutation of code stream

4 Experimental Results

  1. (1)

    Histogram:

All Fig. 9 experiments have been performed on MATLAB. For ensuring encryption quality, there is a need to perform histogram test of the input and encrypted image.

  1. (2)

    Peak Signal-to-Noise Ratio (PSNR): It is given by the formula mentioned below

    Fig. 9
    figure 9

    a Lena image, b Encrypted image, c Histogram of (a), d Histogram of (b)

    $${\text{PSNR}} = 20\log_{10} \frac{255}{{\sqrt {\text{MSE}} }}$$

where MSE is given by \({\text{MSE}} = \frac{1}{\text{LL}}\sum\nolimits_{i = 1}^{L} {\mathop \sum \nolimits_{j = 1}^{L} \left( { m_{ij} - n_{ij} } \right)^{2} }\), m and n are output and input image coordinates, respectively at location (i, j).

Table 1 shows the PSNR value for the proper reconstructed image at the decoder end. For the quality of image to be better, PSNR value should be high.

Table 1 PSNR table
  1. (3)

    Compression Ratio: By definition, it is the ratio of uncompressed image to the compressed image size (Fig. 10).

    Fig. 10
    figure 10

    Compression ratio chart

    The above chart shows that the compression ratio is not affected by the encryption process.

  2. (4)

    Key Sensitivity Test: An algorithm is said to be good if it is key sensitive. A minute modification in the key value should make a huge difference. In this, one bit in the key value is modified, which leads to the failure of decryption process at the decoder end (Table 2).

    Table 2 Key sensitivity test table

5 Conclusion

This paper presented secure and fast joint image compression and encryption algorithm which is based on DWT, secure SPIHT, and 3D chaotic system. This chaos values are very secure and sensitive in nature, which provides excellent encryption process, while compression part is carried out by basic SPIHT. By employing various evaluation parameters, security tests and performance tests are performed to validate the goals.