1 Introduction

Since the advent of the big data era, rapid advances in information technology and the internet have significantly enhanced the ease and efficiency of communication. With the widespread use of public networks for information transmission, a host of potential security vulnerabilities have emerged. Among various forms of data, images stand out as the most visually intuitive, often containing substantial personal information. Therefore, the protection of image data confidentiality during transmission and storage has emerged as a critical aspect of information security management. Thus, the integration of cryptography into the domain of image information security stands as a critical imperative.

The AES and DES are common methods to protect text information. However, the effectiveness and security of these algorithms for image data could not meet requirement. Chaotic systems have the characteristics that suitable for image encryption systems, such as initial values sensitivity and pesudo-randomness [40]. Matthews [16] was the first to apply chaotic systems to cryptosystems, while Fridrich [4] originally employed chaotic systems in image encryption. Therefore, more and more attention has been paid to the research of digital image encryption based on chaotic systems. The image cryptosystem which used low dimensional chaos has a small key space, which is hard to resist brute force attack. The image encryption based on coupled map lattices which have great chaotic characteristics has large key space and good effect. The coupled map lattice model was originally proposed by Kaneko [9]. Later, the coupled map lattice model of spatiotemporal chaos is gradually proposed. Rajesh et al. [22] proposed the global nonlocal collapsible mapping lattice (GNCML). The one-way coupled mapping lattice (OCML) was proposed by Meherzi et al. [18]. The two-Way coupled logistic map lattice (TCML) was proposed by Liu et al. [13]. Zhang et al. [39] proposed hybrid linear-nonlinear coupled mapped lattice. A Logistic-Chebyshev dynamic coupled map lattices model (LCDCML) was proposed by Wang et al. [31]. He et al. [6] proposed a new image encryption algorithm based on two-dimensional spatiotemporal chaotic system. These models have unstable lattices with chaotic characteristic in the whole space, and most lattices are not in chaotic state.

The traditional Nyquist theorem require the sampling frequency more the twice the highest frequency, but the sampled data contain large amount of redundant data. Hence, a new random sampling method called compressed sensing (CS) is proposed, which can sample a signal at a frequency that lower than Nyquist theorem and recover the entire signal from fewer measurements [8, 12, 19]. Firstly, the coefficient matrix is obtained by frequency domain transformation, then the coefficient matrix is compressed by CS. Next the signal is reconstructed by orthogonal matching pursuit (OMP) algorithm. Wei et al. [32] proposed a fast image encryption algorithm based on parallel compressive sensing and DNA sequence. The Logistic-Tent (LTS) chaotic system is employed to derive measurement matrices for parallel compressive sensing. Subsequently, a DNA matrix is created through encoding and blocking the compressed and encrypted image. Next, the Logistic-Sine system (LSS) is utilized to diffuse chaotic DNA matrix. This scheme have highly plaintext sensitivity. Whereas, this scheme has low recovery quality. Liu et al. [15] proposed an image compression and encryption scheme based on 2D compressive sensing and hyperchaotic system. The image is compressed by using 2D compressive sensing. In the finite domain, compression sensing generates a cipher image that is dispersed through multiplication inversion. However, the image recovery quality is less than satisfactory. Liu et al. [14] proposed an image compression and encryption algorithm based on compressive sensing and nonlinear diffusion. Their algorithm can achieves image compression while encrypting, and this scheme can enhance security of image encryption. Nevertheless, the PSNR values are mostly below 30dB, the compression performance is not good enough. Wang et al. [27] proposed a double color images compression-encryption via compressive sensing. This scheme utilizes compressive sensing to compress the image and Latin squares to shuffle the measurements. It improves the efficiency of transmitting data and distributing keys. However, this scheme have weak compression performance.

For solving the problems of above schemes, an novel dynamic compressed sensing method for image encryption based on a new coupled map lattices model is proposed in this paper. The detailed contributions are as follows:

  1. (1)

    A new coupled map lattices model called the logistic-sine coupled map lattices (LSSCML) is proposed. The dynamics analysis shows that all lattices of LSSCML system are in a chaotic state in the whole parameter space and are in a stable chaotic state. Indicating that the LSSCML system has better chaotic properties than the traditional CML system.

  2. (2)

    A method of dynamic compressed sensing is proposed, which can generate different measurement matrices according to different compression ratios, this method preserves as much valid information as possible in compressed process and significantly improves compression performance and efficiency.

  3. (3)

    A Fisher–Yates simultaneous permutation and diffusion algorithm is proposed, which concurrently do diffusion and permutation. The security analyses result indicate that our proposed image cryptosystem can improve the performance of permutation and diffusion.

This paper is organized as follows: in the Sect. 2, we propose a new LSSCML coupled map lattices model and evaluate its dynamics performance. In the Sect. 3, our propose a dynamic compressed sensing method and introduce image encryption and decryption algorithm. In the Sect. 4, the security analysis and compression performance of our cryptosystem are evaluated. In the Sect. 5, this paper is concluded.

2 Preliminary

2.1 Logistic map

May [17] proposed the Logistic map, which is given by Eq. (1).

$$\begin{aligned} x_{n+1}=\mu x_n(1-x_n) .\end{aligned}$$
(1)

where control parameter \(\mu \in [0,4]\) and variable \(x\in [0,1]\). The bifurcation diagram and lyapunov exponent diagram of the Logistic map are shown in Figs. 1a and 2a.

2.2 CML model

The coupled map lattices model was first proposed by Kaneko [9], the coupled map lattices is given by Eq. (2).

$$\begin{aligned} x_{n+1}(i)= & {} (1-\varepsilon ) f\left( x_n(i)\right) +\left( \frac{\varepsilon }{2}\right) \left[ f\left( x_n(i-1)\right) \right. \nonumber \\{} & {} \left. +f\left( x_n(i+1)\right) \right] .\end{aligned}$$
(2)

where n is time component, i is lattices number, \(\varepsilon \in (0,1)\) is coupling coefficient. The \(i+1\) and \(i-1\) represent the two adjacent lattices before and after the i lattice. And \(f(x_n)=\mu x_n(1-x_n)\).

2.3 Logistic–Sine system

Chanil Pak et al. [20] proposed the Logistic-Sine System (LSS), the LSS map is given by Eq. (3).

$$\begin{aligned} x_{n+1}=\left( \mu x_n\left( 1-x_n\right) +(4-\mu ) \sin \left( \pi x_n\right) / 4\right) \bmod 1 .\end{aligned}$$
(3)

where \(\mu \) and \(x_n\) are control parameter and state variable, \(\mu \in (0,4), x_n \in (0,1)\). The bifurcation diagram of the LSS map is shown in the Fig. 1b. The lyapunov exponent diagram of the LSS map is shown in the Fig. 2b. As shown in the Fig. 1b, the chaotic sequences are uniformly distributed throughout the parameter interval of \(\mu \in (0,4)\). The LSS map is chaotic throughout parameter interval, and LSS map does not have periodic window compared with the logistic map. The chaotic characteristic of LSS system is great. As shown in the Fig. 2b, the lyapunov exponent is always close to 0.7 throughout the parameter interval of \(\mu \in (0,4)\). Compared to the logistic map, the LSS map have larger range of chaotic distribution.

Fig. 1
figure 1

Bifurcation diagram of logistic and LSS map

Fig. 2
figure 2

Lyapunov exponent of logistic and LSS map

2.4 LSSCML model

The LSSCML system is based on the model of coupled map lattices and enhances its dynamic characteristics by substituting the logistic map with an LSS map. Moreover, we employ a non-adjacent coupling mode utilizing the Arnold map to determine the locations of coupling. The LSSCML system is given by Eq. (4).

$$\begin{aligned} {\left\{ \begin{array}{ll}\begin{bmatrix} j\\ k\end{bmatrix}=\begin{bmatrix}1&{}\alpha \\ \beta &{}\alpha \beta +1\end{bmatrix}\begin{bmatrix}i\\ i\end{bmatrix}({\textrm{mod}}L)\\ f(x_n)=(\mu x_n(1-x_n)+(4-\mu )sin(\pi x_n/4)) \bmod 1\\ x_{n+1}(i)=(1-\varepsilon ) f(x_n(i))+(\frac{\varepsilon }{2})[f(x_n(j))+f(x_n(k))]\end{array}\right. }.\end{aligned}$$
(4)

where \(\alpha \) and \(\beta \) are parameters of Arnold map, \(\varepsilon \in (0,1)\) is coupling coefficient of CML and \(\mu \in (0,4)\) is control parameter of LSS, and the L is the number of lattices. The j and k are lattices locations are generated by Arnold map in relation to i. The \(f(x_n)\) is LSS map.

Fig. 3
figure 3

Kolmogorov–Sinai entropy: a Kolmogorov–Sinai entropy density; b Kolmogorov–Sinai entropy breath

2.4.1 Kolmogorov–Sinai entropy density

The coupled map lattices is a high dimensional system, L lattices are regarded as L dimensions. And the Kolmogorov–Sinai entropy is computed by summing all the positive Lyapunov exponents [24]. The Kolmogorov–Sinai entropy density (KED) is defined as Eq. (5).

$$\begin{aligned} h=\frac{\sum _{i=1}^L \lambda ^{+}(i)}{L}. \end{aligned}$$
(5)

where \(\lambda ^{+}(i)\) denote positive Lyapunov exponents, L is all lattice numbers. When \(h>0\), the coupled map lattices manifests as a chaotic state, when \(h<0\), the coupled map lattices manifests as a periodic state. When the KED is high, the system exhibits complex behavior and changes unpredictably.

2.4.2 Kolmogorov–Sinai entropy breadth

To delve into the uncertainty and complexity of space lattices in detail. And Kolmogorov–Sinai entropy breadth (KEB) is used to evaluate the universality of L lattices at the spatial dimension [29, 30], and the KEB is given by Eq. (6).

$$\begin{aligned} h u=\frac{L^{+}}{L}. \end{aligned}$$
(6)

where \(L^{+}\) are lattice numbers that Lyapunov exponents more than 0, hu represent percentage of lattice with a chaotic state. The closer hu is to 1, the more lattices manifest as chaotic state, indicating that performance of chaotic system is more excellent.

The Kolmogorov–Sinai entropy of LSSCML system is shown in Fig. 3. As shown in the Fig. 3 (a) and (b), the \(h>0\) in the whole parameter interval and hu is always equal to 1, indicating that all lattices remain in steady chaotic state throughout the interval.

2.4.3 Spatiotemporal behavior

In the whole parameter range of \(\mu \in (0,4)\), the LSSCML system is in complete turbulence pattern. As shown in the Fig. 4, the spatiotemporal behavior development map is filled with chaotic regions, and chaotic behavior exists in the whole space.

Fig. 4
figure 4

Complete turbulence pattern: a spatiotemporal behavior at \(\mu =0\); b spatiotemporal behavior at \(\mu =2.137\); c spatiotemporal behavior at \(\mu =3.325\); d spatiotemporal behavior at \(\mu =4\)

Fig. 5
figure 5

Sample graph of dynamic compressed sensing: a measurement matrix at \(C\!R\le 0.5\); b measurement matrix at \(C\!R>0.5\)

3 Dynamic compressed sensing method and image encryption scheme

3.1 Dynamic compressed sensing method

3.1.1 Traditional compressed sensing

Compressed sensing is a method of random sampling at much lower than Nyquist frequency, and the signal is compressed when the signal is randomly sampled [33]. The definition of compressed sensing is given by Eq. (7).

$$\begin{aligned} y=\varPhi X=\varPhi \varPsi \alpha . \end{aligned}$$
(7)

where \(\varPhi \) is a measurement matrix satisfying Gaussian distribution, \(\varPsi \) is sparse matrix, \(\alpha \) is sparse signal, and \(\varPhi \) satisfy irrelevance. For compressed sensing, the signal satisfy sparsity and irrelevance, then the signal recovery can be realized. The signal is reconstructed by the Eq. (8).

$$\begin{aligned} \min \Vert \alpha \Vert _0 \quad \text{ s.t. } y=\varPhi \varPsi \alpha . \end{aligned}$$
(8)

where \(\min \Vert \alpha \Vert _0\) denotes \(l_0\) norm of signal \(\alpha \). The initial signal is recovered by using orthogonal matching pursuit (OMP) [25].

3.1.2 Our proposed dynamic compressed sensing method

After the image matrix transformed by frequency domain, the bottom right corner of matrix mainly includes high-frequency part and the top left corner of matrix mainly includes low-frequency part that contain the important content of the image. Consider as the characteristics mentioned above, a dynamic compressed sensing method is proposed in this paper, which compresses the important information areas of image as much as possible and improve compression performance. The sample graph of dynamic compressed sensing is shown in the Fig. 5, the low-frequency part of the top left corner is compressed, and different compression region and different measurement matrix \(\varPhi _i\) are obtained according to different compression rates. Dynamic compressed sensing method as follow:

Step 1: Construct a basic measurement matrix \(\varPhi (M,N)\), which satisfy Gaussian distribution.

Step 2: Set the length of the side of the compression region according to compression ratio. If \(C\!R\le 0.5\), triangular part of the top left corner of matrix is compression region, and the length of the side is r. If \(C\!R>0.5\), compression region is divided into rectangular and trapezoidal, and the length of the side are N and \(N-h\).

Step 3: If \(C\!R\le 0.5\), compression region is triangular part, compression region of each column is gradually decreasing, so the r columns of the compression region correspond to r different measurement matrices, which is extracted from basic measurement matrix \(\varPhi (M,N)\). The column number of these r measurement matrices remain unchanged, while the row number decrease gradually from r to 1. Detailedly, the length of the side \(r=\lfloor \sqrt{M\times N\times C\!R}\rfloor \), where ‘\(\lfloor x \rfloor \)’ means the integer part of x. The r different measurement matrices are \(\varPhi _1(r,N), \varPhi _2(r-1,N), \varPhi _3(r-2,N),\ldots , \varPhi _{r-1}(2,N), \varPhi _{r}(1,N)\subseteq \varPhi (M,N)\).

Step 4: If \(C\!R>0.5\), compression region have rectangular part and trapezoidal part, rectangular part is the complete compression region, and the measurement matrices of rectangular part are \(N-h\) basic measurement matrices. However compression region of each column of trapezoidal part is gradually decreasing, so the h columns of trapezoidal part correspond to h different measurement matrices, which is extracted from basic measurement matrix \(\varPhi (M,N)\), the column number of these h measurement matrices remain unchanged, while the row number decrease gradually from M to \(M-h\). Detailedly, the measurement matrices of rectangular part are \(\varPhi _1(M,N), \varPhi _2(M,N),\ldots , \varPhi _{N-h}(M,N)=\varPhi (M,N)\). While \(h=\lfloor \sqrt{M\times N\times (1-C\!R)}\rfloor \), the measurement matrices of trapezoidal part are \(\varPhi _{N-h+1}(M-1,N), \varPhi _{N-h+2}(M-2,N),\ldots , \varPhi _{N-1}(M-h+1,N), \varPhi _N(M-h,N)\subset \varPhi (M,N)\).

The dynamic compressed sensing performs \(O(M\times N)\) operation and requires \(M\times N\) memory units to store measurement matrix, the M and N are size of plain image. Compared to the 1D-CS, Block 1D-CS, 2D-CS and Block 2D-CS, their computational complexity are \(O(M^2\times N^2), O(m\times N^2), O(M\times N^2)\) and \(O(m\times n^2)\), respectively [21], where m and n are size of sampled image. Our proposed dynamic compressed sensing have less computational complexity.

3.2 Image encryption scheme

In this subsection, we will introduce our proposed image encryption detailedly. The plain image P and external keys K as input, a cipher image is obtained through the generation of chaotic matrix, dynamic compression sensing, permutation and diffusion. The flowchart of the image encryption scheme is shown in the Fig. 6.

Fig. 6
figure 6

The flowchart of image encryption scheme

3.2.1 Plaintext-related internal keys and chaotic matrix generation

In order to make the chaotic sequences contain all the plain information and the external keys information, a method of plaintext-related internal keys generation is proposed. So the generated chaotic matrix has strong key sensitivity and plaintext sensitivity. The detailed steps are as follows:

Step 1: Input \(M\times N\) 8-bit plain image P and external keys \(K=k_1,k_2,\ldots .,k_{10}\in (0,1)\).

Step 2: Input plain image matrix P into Eq. (9) and (10) to calculate the summation of column and row, denote as vector \(P\!R\) and \(P\!C\), respectively. Input vectors \(P\!R\) and \(P\!C\) into Eq. (11) to generate a combined plain information \(C\!P\!I\).

$$\begin{aligned} P\!R(j)= & {} \sum _{i=1}^M P(i,j), ~~ j=1,2,\ldots N \end{aligned}$$
(9)
$$\begin{aligned} P\!C(i)= & {} \sum _{j=1}^N P(i,j), ~~ i=1,2,\ldots M \end{aligned}$$
(10)
$$\begin{aligned} C\!P\!I= & {} \sum _{i=1}^M ((P\!R(i)\times P\!C(i)) \bmod 256). \end{aligned}$$
(11)

Step 3: Input external keys K into Eq. (12) to calculate summation (\(SU\!M_K\)) of the keys, and input \(C\!P\!I\) and \(SU\!M_K\) into Eq. (13) to generate the combined information \(C\!I\), which is output as additional cipher C2

$$\begin{aligned}{} & {} SU\!M_K=\sum _{i=1}^{10} K(i). \end{aligned}$$
(12)
$$\begin{aligned}{} & {} C\!I= C\!P\!I\times SU\!M_K. \end{aligned}$$
(13)

Step 4: Input \(C\!I\) and external keys K into Algorithm 1 to generate plaintext-related internal keys \(I\!K\).

Algorithm 1
figure a

Plaintext-related internal keys generation

Step 5: The internal keys \(I\!K\) are input into LSSCML system (Eq. (4)) as initial values to iterate 100 times, and a \(100\times 100\) matrix X is generated.

Step 6: Input matrix X into Algorithm 2 to generate optional initial values \(O\!I\!V\).

Algorithm 2
figure b

Key-controled initial values option algorithm

Step 7: Input optional initial values \(O\!I\!V\) into Algorithm 3 to generate chaotic matrix \(C\!C\!M\).

Algorithm 3
figure c

Chaotic matrix generation algorithm

3.2.2 Dynamic compressed sensing

After sparse transformation, most of the energy of the image is concentrated in the low-frequency part of the upper left corner, while the high-frequency part is distributed in the lower-right corner. If the traditional method is used, some low-frequency information will be lost. In this paper, we proposed a dynamic compressed sensing method (see Sect. 3.1.2), which sets different measurement matrices according to different compression rates to compress the image. So many low-frequency parts are retained, and the compressed matrix is quantified in groups to reduce the loss of information. The specific steps are as follows:

Step 1: Input \(M\times N\) 8-bit plain image P, which is transformed by Discrete Wavelet Transform (DWT) to obtain the DWT coefficient matrix \(C\!M\).

Step 2: Convert the chaotic matrix \(C\!C\!M\) to a \(M\times N\) transition matrix \(T\!M\), which is input into Eq. (14) to generate the basic measurement matrix \(\varPhi \).

$$\begin{aligned} \varPhi =-\sqrt{1/M}\times {\text {erfc}}(T\!M). \end{aligned}$$
(14)

where

$$\begin{aligned} {\text {erfc}}(x)=\frac{2}{\sqrt{\pi }} \int _x^{\infty } e^{-\eta ^2} d \eta .\end{aligned}$$
(15)

Step 3: Input the basic measurement matrix \(\varPhi \) into Algorithm 4 to generate the measurement matrices \(\varPhi _i\) under different compression ratio.

Step 4: Input the DWT coefficient matrix \(C\!M\) and measurement matrix \(\varPhi _i\) into Algorithm 5 to generate a group of measurements \(G\!M\). The length of measurements \(G\!M\), called \(M\!L\) is output as parameter of reverse grouping quantization.

Algorithm 4
figure d

Different measurement matrix generation algorithm

Algorithm 5
figure e

Measurements generation algorithm

Step 5: Input measurements \(G\!M\) into Algorithm 6 to do group quantization, which is used to quantize the measurements \(G\!M\) to a range of [0,255], and the quantization matrix \(Q\!M\) is obtained. The length of vector \(T\!Q\!M\!V\), named \(T\!Q\!M\!L\) is output as a parameter of reverse grouping quantization.

Algorithm 6
figure f

Grouping quantization algorithm

3.2.3 Permutation and diffusion

A method of high-performance Fisher–Yates simultaneous permutation and diffusion algorithm is proposed, which is given in Algorithm 7. And the sample graph is shown in the Fig. 7. Line(4–5), generate key streams \(K\!ey1\) and \(K\!ey2\) by chaotic matrix \(C\!C\!M\). Line(6–12), do Fisher–Yates simultaneous permutation and diffusion. Line (13), output cipher image C.

Algorithm 7
figure g

Fisher–Yates simultaneous permutation and diffusion algorithm

3.2.4 Decryption scheme

The decryption process is the reverse process of encryption, input cipher image C, additional cipher C2, and external keys K. After reverse permutation-diffusion and reconstruction, output a decrypted image \(D\!I\). Decryption flowchart is given in Fig. 8, the detailed descriptions are as follows:

Step 1: Input cipher image C, additional cipher C2 and external keys K.

Step 2: Input the additional cipher C2 as \(C\!I\) and external keys K into Algorithm 1 to generate internal keys \(I\!K\).

Step 3: The internal keys \(I\!K\) are input into LSSCML system (Eq. (4)) as initial values to generate matrix X.

Step 4: Input matrix X into Algorithm 2 to generate optional initial values \(O\!I\!V\).

Step 5: Input optional initial values \(O\!I\!V\) into Algorithm 3 to generate chaotic matrix \(C\!C\!M\).

Step 6: The cipher image C and chaotic matrix \(C\!C\!M\) are input into Algorithm 8 to do reverse permutation-diffusion, and obtain a reverse permutation-diffusion matrix \(R\!P\!D\!M\).

Algorithm 8
figure h

Reverse Fisher–Yates simultaneous permutation and diffusion algorithm

Step 7: Input matrix \(R\!P\!D\!M\), length \(T\!Q\!M\!L\) and \(M\!L\) into Algorithm 9 to do reverse grouping quantization, and generate a reverse quantization matrix \(R\!Q\!M\);

Algorithm 9
figure i

Reverse grouping quantization algorithm

Step 8: Input the reverse quantization matrix \(R\!Q\!M\) into Algorithm 10 to generate restructured matrix \(R\!M\);

Step 9: The matrix \(R\!M\) is performed inverse discrete wavelet transform, and the decrypted image \(D\!I\) is generated. The decryption process is finished.

Algorithm 10
figure j

OMP reconstruction algorithm

Fig. 7
figure 7

Sample graph of Fisher–Yates simultaneous permutation and diffusion

Fig. 8
figure 8

The flowchart of the decryption scheme

4 Simulation and security analysis

In this section, the simulation of our proposed image encryption algorithm and security analysis of the algorithm will be showed. The MATLAB R2016a is used to realize the experimental simulation and performance evaluation. The test images ‘Lena’, ‘Pepper’, ‘Airplane’ and ‘Woman’ are \(512\times 512\) gray images, which are encrypted at \(C\!R\) = 0.2, 0.4, 0.6 and 0.8, respectively. The external keys include \(k_1=0.766384919309384; k_2=0.925448080711511; k_3=0.294857706285411; k_4=0.696904715265515; k_5=0.0277659370500397; k_6=0.316655044283070; k_7=0.780824480045231; k_8=0.953921439972174; k_9=0.576536465927819; k_{10}=0.607144316115033\). The encryption and decryption simulation results are depicted in Fig. 9. Finally, we compare our algorithm with other state of the arts works to show that our algorithm has better advantages.

Fig. 9
figure 9

Simulation results: Column (1) are the plain images. Column (2), (4), (6) and (8) are cipher images which encrypted at CR = 0.2, 0.4, 0.6 and 0.8, respectively. Column (3), (5), (7) and (9) are decrypted images of column (2), (4), (6) and (8), respectively. Row (ad) are simulation results of ‘Airplane’, ‘Lena’, ‘Peppers’ and ‘Woman’, respectively

Table 1 The NIST test results

4.1 Key space

The key space includes all valid keys. So the length of valid key of encryption algorithm are size of key space [7]. The keys of proposed encryption algorithm in this paper include \(k_1,k_2,k_3,k_4,\ldots \ldots k_{10}\), and change step of each key is \(10^{15}\). Hence the size of key space is \((10^{15})^{10}=10^{150}\approx 2^{499}>2^{100}\) in this paper. Therefore, our proposed image cryptosystem has a large enough key space to effectively resist brute-force attacks [1, 5].

4.2 NIST SP800-22 test

In order to evaluate the randomness of chaotic sequences, we use the NIST SP800-22 test [23] to evaluate the randomness of chaotic sequences generated by our proposed LSSCML system. The NIST SP800-22 test contain 15 test methods, if all the \(p-value\) generated by these 15 methods are more than 0.01, the chaotic sequences have enough randomness. The NIST test results are shown in Table 1. The test results show that the chaotic sequences pass all the NIST SP800-22 test, which indicate that chaotic sequences have great randomness.

4.3 Statistical analysis

4.3.1 Histogram analysis

In this section, histogram is used to evaluate statistical property of the cipher image. The uniform distribution of histogram of cipher image is more obvious, and the statistical property of the cipher image is better [28]. The uniformity of histogram is evaluated by using Chi-square test, the equation of the Chi-square test is given by Eq. (16).

$$\begin{aligned} \chi ^2=\sum _{i=1}^{255} (f_i-g)^2/g. \end{aligned}$$
(16)

where \(f_i\) is frequency distribution of cipher image, g is theoretical frequency distribution. When CR = 0.5, test results of histogram are shown in the Fig. 10, row (a) are plain images. Row (b) are histograms of the corresponding plain images. Row (c) are cipher images which encrypted at CR = 0.5. Row (d) are histogram of the corresponding cipher images. Column (1–4) are histogram test results of ‘Airplane’, ‘House’, ‘Lena’ and ‘Peppers’, respectively. The test results of Chi-square of histogram of cipher images are shown in the Table 2. All the P-values are above 0.01 indicate that the histograms of cipher images exhibits a uniform distribution and that our proposed image cryptosystem is resistant to statistical attacks.

4.3.2 Correlation coefficient analysis

The correlation between image pixels is evaluated by correlation coefficient [3]. The correlation of plain image is relatively strong, but correlation coefficient of cipher image is comparatively small. The correlation coefficient is defined as Eq. (17).

$$\begin{aligned} r_{x y}=\frac{{\text {cov}}(x, y)}{\sqrt{D(x)} \cdot \sqrt{D(y)}}. \end{aligned}$$
(17)

where x and y are gray value of adjacent two pixels, and

$$\begin{aligned}{} & {} E(x)=\frac{1}{N} \sum _{i=1}^N x_i \end{aligned}$$
(18)
$$\begin{aligned}{} & {} {\text {cov}}(x, y)=\frac{1}{N} \sum _{i=1}^N\left( x_i-E(x)\right) \left( y_i-E(y)\right) . \end{aligned}$$
(19)
$$\begin{aligned}{} & {} D(x)=\frac{1}{N} \sum _{i=1}^N\left( x_i-E(x)\right) ^2. \end{aligned}$$
(20)

To intuitively reflect correlation of adjacent pixels of image, we first randomly choose 2000 pixels, and take the selected pixel value and corresponding adjacent pixel value as coordinates to draw correlation graph. The test results of correlation are shown in Fig. 11, which indicate the adjacent pixels of plain image have strong correlation, and our proposed image cryptosystem break the correlation adjacent pixels of plain image, the adjacent pixels of cipher image have weak correlation. Fig. 11 rows (a), (c) and (e) are the correlation of plain images ‘Airplane’, ‘House’ and ‘Lena’, respectively. Rows (b), (d) and (f) are the correlation of cipher images ‘Airplane’, ‘House’ and ‘Lena’ encrypted at CR = 0.5, respectively. Column (1) are plain images and cipher images. Column (2–4) are correlation test results of ‘Horizontal direction’, ‘Vertical direction’ and ‘Diagonal direction’, respectively. The test results of correlation coefficients are shown in the Table 3. The test results show that all correlation coefficients are close to 0 at different compression rate, indicating the proposed encryption scheme can resist statistical attacks.

Fig. 10
figure 10

Test results of histogram: row a are plain images. Row b are histograms of plain images. Row c are cipher images which encrypted at CR = 0.5. Row d are histogram of cipher images. Column (1–4) are histogram test results of ‘Airplane’, ‘House’, ‘Lena’ and ‘Peppers’, respectively

Table 2 Test results of Chi-square (P-value)
Fig. 11
figure 11

Test results of correlation: rows a, c and e are the correlation of plain images ‘Airplane’, ‘House’ and ‘Lena’, respectively. Rows b, d and f are the correlation of cipher images ‘Airplane’, ‘House’ and ‘Lena’ encrypted at CR = 0.5, respectively. Column (1) are plain images and cipher images. Column (2–4) are correlation test results of ‘Horizontal direction’, ‘Vertical direction’ and ‘Diagonal direction’, respectively

Table 3 Test results of correlation coefficients
Table 4 Plaintext sensitivity analysis

4.4 Differential attack

The difference between the two images are measured by using the number of pixels change rate (NPCR) and unified average changing intensity (UACI) [36]. The UACI and NPCR are given by Eq. (21) and (22), respectively.

$$\begin{aligned} \textrm{UACI}&=\frac{1}{M \times N}\left( \sum _{i=1}^M \sum _{j=1}^N \frac{\left| C_1(i, j)-C_2(i, j)\right| }{255}\right) \nonumber \\&\quad \times 100\%. \end{aligned}$$
(21)
$$\begin{aligned} \textrm{NPCR}&=\frac{\sum _{i=1}^M \sum _{j=1}^N D(i, j)}{M \times N} \times 100\%. \end{aligned}$$
(22)

where

$$\begin{aligned} D(i, j)=\left\{ \begin{array}{ll} 0, &{} C_1(i, j)=C_2(i, j) \\ 1, &{} C_1(i, j) \ne C_2(i, j) \end{array},\right. \end{aligned}$$
(23)

where \(C_1(i, j)\) and \(C_2(i, j)\) are the value of pixel corresponding to two different images, M and N are length and width of the image. The critical values of NPCR and UACI at different sizes are calculated to to assess the resistance against differential attacks. Wu et al. [34] proposed the NPCR critical value, and the NPCR critical value is defined as Eq. (24).

$$\begin{aligned} \mathcal {N}_\alpha ^*=\left( F-\varPhi ^{-1}(\alpha ) \sqrt{\frac{F}{M\times N}}\right) /(F+1). \end{aligned}$$
(24)

where F is maximum supported pixel value, \(\varPhi ^{-1}(\alpha )\) is inverse cumulative distribution function of the standard normal distribution, \(\alpha \) is significance level. If the NPCR value exceeds critical value, illustrating that encryption system is better at defending against differential attacks. The UACI critical interval is given by Equ. (25).

$$\begin{aligned} \begin{array}{l} \mathcal {U}_\alpha ^{*-}=\mu _u-\varPhi ^{-1}(\alpha / 2) \sigma _u \\ \mathcal {U}_\alpha ^{*+}=\mu _u+\varPhi ^{-1}(\alpha / 2) \sigma _u \end{array}.\end{aligned}$$
(25)

where

$$\begin{aligned} \begin{aligned} \mu _u&=(F+2)/(3F+3)\\ \sigma _u&=\sqrt{\frac{(F+2)(F^2+2F+3)}{18(F+1)^2M\times N\times F}} \end{aligned}.\end{aligned}$$
(26)

when the UACI value belong to safe interval \((\mathcal {U}_{\alpha }^{*-},\mathcal {U}_{\alpha }^{*+})\), indicating the two images have enough difference. Table 4 shows the average of 100 NPCR and UACI values. The significance level \(\alpha =0.05\) in this paper, the critical values of NPCR at CR = 0.3, 0.5 and 0.7 are 99.5727%, 99.5810% and 99.5854%, respectively. The critical intervals of UACI under these three compressions are (33.2978%, 33.6292%), (33.3354%, 33.5916%) and (33.3552%, 33.5718%), respectively. All the NPCR values in Table 4 are above the critical value under different compression ratio, and the UACI values of the proposed algorithm are also within the critical interval. The test results exhibit our proposed image cryptosystem completely pass the test of NPCR and UACI, which indicate that our encryption algorithm can resist differential attacks and have great security.

Fig. 12
figure 12

Comparison from encrypted images through tiny modified keys

Fig. 13
figure 13

Decryption with initial keys and tiny modified keys

4.5 Key sensitivity analysis

In key sensitivity test, we will use the initial keys and tiny modified keys to encrypt the plain image and compare their encryption results. Then the initial keys and modified keys are used to decrypted cipher image encrypted with initial keys and decryption results are used to analyse key sensitivity. In this test, we select the gray image ‘Boat’ as test image. Initially, the plain image is encrypted with the initial keys that provided at the beginning of Sect. 4 at CR = 0.5, then we modify one of initial keys by adding \(10^{-15}\). Next the plain image is encrypted with modified keys to generate cipher image, which is compared with the cipher image encrypted with initial keys. Figure 12 displays test results of comparison. Figure 12a is cipher image that encrypted with initial keys. Figure 12b–f are cipher images that encrypted with modified keys \(k_1,k_2,k_3,k_4\) and \(k_5\), respectively. Figure 12g–k are difference between cipher images of \(|(b)-(a)|, |(c)-(a)|, |(d)-(a)|, |(e)-(a)|\) and \(|(f)-(a)|\), respectively. Figure 12l–p are histogram of Fig. 12g–k, respectively. Finally, cipher images are decrypted by using initial keys and modified keys, and test results of decryption are shown in Fig. 13. Figure 13a is plain image. Figure 13b is cipher image encrypted with initial keys at CR = 0.5. Figure 13c is decrypted image with initial keys. Figure 13d–h is decrypted image with modified keys \(k_1,k_2,k_3,k_4\) and \(k_5\), respectively. Furthermore, we use NPCR and UACI to test the difference between two cipher images which generated by encrypting with initial keys and modified keys, and the test results are shown in Table 5. The test results show the NPCR values between each cipher image are more than the critical values 99.5810%, and the UACI values are in the critical interval (33.3354%, 33.5916%). Indicating that our proposed cryptosystem has extremely strong key sensitivity.

4.6 Compression performance analyses

4.6.1 Peak signal to noise ratio (PSNR)

This paper introduces Peak Signal to Noise Ratio (PSNR) to compare the similarity between plain images and decrypted images [37]. The PSNR is used to measure recovery quality of reconstructed images. The PSNR value is higher, and the loss of image quality is smaller. The PSNR can be calculated by Eq. (27).

Table 5 The NPCR and UACI results between cipher images
$$\begin{aligned} \text{ PSNR } =10 \log _{10} \frac{255 \times 255}{\frac{1}{N^2} \sum _{i=1}^N \sum _{j=1}^N\left( P_1(i, j)-P(i, j)\right) ^2} .\end{aligned}$$
(27)

P and \(P_1\) are original image and decrypted image. Table 6 shows that test results of PSNR, with the compression ratio decrease, the PSNR value is also decreased, and the more information is lost in the image during compression. The PSNR values under different compression ratios in the Table 6 remain above 30(dB), which indicate that our proposed image cryptosystem has good recovery quality.

Table 6 Test results of PSNR

4.6.2 Structural similarity index measurement (SSIM)

The image recovery quality is measured by using Structural Similarity Index Measurement (SSIM) [10]. And image structure is used to compare the similarity between original image and recovered image, the SSIM can be calculated by Eq. (28).

$$\begin{aligned} {\text {SSIM}}=\frac{\left( 2 \mu _P \mu _{P_1}+C_1\right) \left( 2 \sigma _{P P_1}+C_2\right) }{\left( \mu _P^2+\mu _{P_1}^2+C_1\right) \left( \sigma _P^2+\sigma _{P_1}^2+C_2\right) } .\end{aligned}$$
(28)

where \(\mu _P \) and \(\mu _{P_1}\) are average value of plain image and recovery image, \(\sigma _P\) and \(\sigma _{P_1}\) are variance yields, \(\sigma _{P P_1}\) is covariance value of P and \(P_1\). The value of SSIM ranges from (0, 1). Table 7 shows that test results of SSIM, and the SSIM value mostly are approaching 1. The closer the SSIM value is to 1, it means that the recovered image is more similar to the original image, the less the distortion of the image, indicating that the compression performance of the proposed image cryptosystem is excellent.

Table 7 Test results of SSIM
Table 8 The Global Shannon entropy test

4.7 Information entropy

The indeterminacy and randomness of image are assessed by utilizing information entropy [41]. Information entropy is a important indictor to checkout encryption performance, if the information entropy is approximately equal to theoretical value, the information contained in the image is more complex, and the randomness is higher [35]. The Global Shannon entropy (GSE) is given by Eq. (29).

$$\begin{aligned} H(S,L)=\sum _{i=0}^{2^L-1}p(s_i)\log _2\frac{1}{p(s_i)} .\end{aligned}$$
(29)

where L is the gray level of the test image, \(p(s_i)\) is the probability of occurrence of the \(s_i\). In order to assess the local randomness of image, the local randomness is tested by using the Local Shannon entropy [26] in this paper. The Local Shannon entropy (LSE) is given by Eq. (30).

$$\begin{aligned} H_{_{k,T_B}}(S,L)=\sum _{i=1}^{k}\frac{H(S_{_{T_B}},L)}{k}. \end{aligned}$$
(30)

Where \(H(S_{_{T_B}})\) is the information entropy of non-overlapping image blocks, k is the number of blocks selected in the cipher image, and \(T_B\) is the number of pixels in each block. In this test, the \(k=30\) and \(T_B=1936\). The test results of the GSE and the LSE are shown in Tables 8 and 9. The global Shannon entropies of different images at each compression rate are close to the theoretical value of 8, while the local Shannon entropies are mostly in the ideal interval. Indicating that the cipher images have good randomness and our proposed image cryptosystem can resist attack.

Table 9 The Local Shannon entropy test

4.8 Robust analysis

It is important that the cipher image could be decrypted when introducing some noise and few data lost in transmission. To prove the robustness of our proposed image cryptosystem, we introduce the cropping attacks and noise attacks. In this test, we encrypt the \(512\times 512\) ‘Lena’ image at CR = 0.5, then select the three regions from the cipher image for cropping attack, and introduce three different intensities of salt and pepper noise to the cipher image for noise attack. The test results are shown in Fig. 14. Figure 14a–c are cipher images with 1\(\times 10^{-3}, 1\times 10^{-4}, 2\times 10^{-4}\) salt and pepper noise, respectively. Figure 14d–f are corresponding recovered images of (a-c), respectively. Figure 14g–i are cipher images with \(32\times 32, 16\times 32\) and \(8\times 32\) data loss, respectively. Figure 14j–l are corresponding recovered images of (g-i), respectively. Table 10 shows that the PSNR between the plain image and recovered images with noise and cropping attacks. The test results indicate that our proposed image cryptosystem has good robustness.

Table 10 The PSNR between the plain image and recovered images with noise and cropping attacks
Fig. 14
figure 14

The test results of robust analysis. ac are cipher images with 1\(\times 10^{-3}, 1\times 10^{-4}, 2\times 10^{-4}\) salt and pepper noise, respectively. df are recovered images of ac, respectively. gi are cipher images with \(32\times 32, 16\times 32\) and \(8\times 32\) data loss, respectively. Figure jl are recovered images of gi, respectively

4.9 Comparison

In this section, our proposed image cryptosystem is compared with other works in recent years. The \(256\times 256\) test image is encrypted at CR = 0.5 for comparison. Table 11 shows that test results of some recent paper, the PSNR values of Ref. [27] and Ref. [38] are smaller than our work. The cipher image of Ref. [27] and Ref. [14] have poor randomness. The Ref. [14] have a weak plaintext sensitivity. The comparison results indicate that our proposed image cryptosystem exhibit better security.

Table 11 The comparison result

5 Conclusions

An novel dynamic compressed sensing method for image encryption based on a new coupled map lattices model is proposed in this paper. A new LSSCML chaotic system is proposed, which have bigger parameter space and every lattice is in the stable chaotic state. The LSSCML system preferably satisfies the characteristics of cryptography compared with conventional coupled map lattices. A method of dynamic compressed sensing is proposed, which set different measurement matrices at different compression rates to compress the image. The dynamic compressed sensing method signally improve compression performance. Based on LSSCML model and dynamic compressed sensing, we propose an image compression and encryption algorithm. Through key space analysis, correlation analysis, histogram analysis, differential attack analysis and key sensitivity analysis, which prove our proposed image cryptosystem has good compression performance and security performance.