Introduction

Images serve as a medium for transmitting information in daily life. However, they are susceptible to illegal copying, theft, and tampering during the transmission process. So, it becomes essential to protect the security of image information. Image encryption technology is an important means to protect the security of image information, and researchers continually propose and improve various image encryption schemes. Among them, optical image encryption has been widely used because of its advantages of high-speed parallelism, large dimensions of key space, large amounts of information data and parallel processing [1, 2]. Among various optical image encryption schemes, the most representative is the double random phase encoding (DRPE) [3] proposed Refregier and Javidi in 1995. In this encryption scheme, two random phase masks are placed in the input plane and the Fourier plane respectively to encrypt the original image into a stationary white noise. Based on this, the researchers have extended DRPE into various transform domains such as the fractional Fourier transform (FrFT) domain [4,5,6], Fresnel transform (FrT) domain [7, 8], Gyrator transform (GT) domain [9,10,11], linear canonical transform (LCT) domain [12, 13], and have proposed a series of effective image encryption schemes.

In DRPE-based encryption schemes, the transmission of random phase mask keys, which are of the same size as the encrypted image, to the receiver for decrypting the original image poses challenges in terms of key management and transmission [14]. To solve this problem, researchers have proposed some encryption schemes based on chaotic random phase encoding (CRPE), in which the random phase masks are generated using chaotic maps, and the chaotic parameters can replace the whole random phase masks as secret keys. For example, Faragallah et al. [15] proposed an optical double image encryption scheme based on Fresnel transform and chaotic map, in which the random phase masks were generated by the baker map and the Arnold 'scat map. Su et al. [16] proposed a color image encryption scheme based on chaotic fingerprint phase mask, in which the random phase masks were generated by Henon map. Farah et al. [17] proposed an optical image encryption scheme based on fractional Fourier transform and DNA sequence operation, in which the random phase masks were generated by the iterative Lorenz map. Singh et al. [18] proposed an optical image encryption scheme based on Gyrator transform, in which the random phase masks were generated by Logistic map, Tent map and Kaplan-Yorke map.

However, the chaotic random phase masks used in the optical image encryption scheme mentioned above are not associated with the plaintext, and the same key is used to encrypt different images. Once the secret keys are leaked, all images encrypted by this system are at risk of leakage. In addition, Fourier ptychography (FP) [19, 20] is a new computational imaging technique developed in recent years. FP reduces the requirement of spatial coherence as the images are captured in spatial domain [21]. This means that we can use a partially coherent LED matrix to achieve multi-angle lighting [22, 23]. Additionally, compared to traditional lamination imaging, Fourier ptychography introduces the concept of aperture synthesis. By capturing a series of low-resolution intensity images, it is able to recover large field of view and high-resolution light field information. It has been applied in quantitative phase imaging in 3D [24], digital pathology and cytometry [25,26,27], aberration metrology [28,29,30], electron microscopy [31, 32] and other fields. In 2019, Pan et al. [33] first applied the FP with LED illumination to the field of optical image encryption. They combined it with traditional DRPE, proposed a linear space-variant optical cryptosystem based on LED-illuminated Fourier ptychography to realize grayscale image encryption. In this paper, we propose an optical image encryption based on LED-illuminated Fourier ptychography and plaintext-related chaotic random phase mask. In our proposed encryption scheme, the plaintext-related chaotic random phase masks (CRPMs) are generated by chaotic Lozi map [34] and secure hash algorithm (SHA-256) [35]. During the encryption process, the input original image undergoes encryption, resulting in a series of noise-like low-resolution images using two CRPMs and Fourier ptychography methods. During the decryption process, the input original image can be reconstructed and decrypted from a series of low-resolution encrypted images by using Fourier ptychography phase retrieval algorithm [36, 37] with correct keys. In this proposed encryption scheme, the initial values and parameters of the chaotic system, which dependent on plaintext, replace the random phase masks as the keys. The random phase masks are used as intermediate variables, facilitating the transmission and management of secret keys. In addition, the chaotic parameter keys are associated with the plaintext image. When the plaintext image changes, the chaotic parameter keys can be dynamically updated in real time, thereby enhancing the security of the image encryption scheme.

The rest of this paper is organized as follows. “Plaintext-related chaotic random phase masks” provides a detailed description of the generation of the plaintext-related CRPMs. “The proposed image encryption scheme” introduces the encryption-decryption process of the proposed scheme. “Experiment results and analysis” presents the numerical simulations of the proposed scheme. Lastly, “Conclusions” concludes the paper.

Plaintext-related chaotic random phase masks

In this paper, the plaintext-related CRPMs are generated by the chaotic Lozi map and SHA-256. The generation process shown in Fig. 1 mainly consists of the following steps:

Fig. 1
figure 1

Schematic of the generation procedure of CRPM

Step 1: Calculate the hash value \(H\) of the plaintext image using SHA-256:

$$H = \left[ {h_{1} ,h_{2} , \cdots ,h_{64} } \right]$$
(1)

Step 2: Generate the initial values of the chaotic Lozi map through the following way:

$$\left\{ {\begin{array}{*{20}l} {x = x_{0} + hex2dec\left( {H\left( {h_{i} :h_{i + 4} } \right)} \right) \times 10^{ - 16} } \hfill \\ {y = y_{0} + hex2dec\left( {H\left( {h_{j} :h_{j + 4} } \right)} \right) \times 10^{ - 16} } \hfill \\ \end{array} } \right.$$
(2)

where,\(i\),\(j\) are positive integers ranging from \(\left[ {1,64} \right]\), \(x_{0}\), \(y_{0}\) are initial values of the Lozi map, \(x\), \(y\) are generated initial values of the Lozi map, \(hex2dec\left( h \right)\) is used to convert a hexadecimal number h to a decimal number.

Step 3: Assume that the size of the CRPMs to be generated is \(M \times N\), then the chaotic Lozi map with initial values of \(x\), \(y\) and parameters of \(\alpha = 1.75\), \(\beta = 0.33\) should iterate \({{\left( {M \times N} \right)} \mathord{\left/ {\vphantom {{\left( {M \times N} \right)} 2}} \right. \kern-0pt} 2}\) times:

$$\left\{ {\begin{array}{*{20}l} {X = \left\{ {x_{1} ,x_{2} , \cdots ,x_{{\left( {M \times N} \right)/2}} } \right\}} \hfill \\ {Y = \left\{ {y_{1} ,y_{2} , \cdots ,y_{{\left( {M \times N} \right)/2}} } \right\}} \hfill \\ \end{array} } \right.$$
(3)

Step 4: Limit the value of each element in the two random sequences to the interval [0,1] through the following way:

$$\left\{ {\begin{array}{*{20}l} {x^{\prime}_{k} = double\left( {unit8\left( {x_{k} \times 1000\bmod 256} \right)} \right)/255} \hfill \\ {y^{\prime}_{k} = double\left( {unit8\left( {y_{k} \times 1000\bmod 256} \right)} \right)/255} \hfill \\ \end{array} } \right.$$
(4)

where \(k = 1,2, \cdots ,{{\left( {M \times N} \right)} \mathord{\left/ {\vphantom {{\left( {M \times N} \right)} 2}} \right. \kern-0pt} 2}\); \(\bmod\) is the symbol for modulus operation; \(unit8\left( \cdot \right)\) represents the operation of converting a variable to an unsigned integer.

Step 5: Combine the two random sequences consisting \(x^{\prime}_{k}\) and \(y^{\prime}_{k}\) to create a new random sequence \(Z\):

$$Z = \left\{ {x^{\prime}_{1} ,x^{\prime}_{2} , \cdots ,x^{\prime}_{{\left( {M \times N} \right)/2}} ;y^{\prime}_{1} ,y^{\prime}_{2} , \cdots ,y^{\prime}_{{\left( {M \times N} \right)/2}} } \right\}$$
(5)

Step 6: Convert the random sequence \(Z\) into a 2D random matrix \(RM\) of size \(M \times N\):

$$RM = reshape(Z,M,N)$$
(6)

Step 7: The CRPM can be generated through the following way:

$$CRPM = \exp \left( {i \cdot 2\pi \cdot RM} \right)$$
(7)

The initial value for the Lozi map can be generated by altering the values of \(i\) and \(j\). By repeating steps 3–6, we can obtain a series of different plaintext-dependent CRPMs.

The proposed image encryption scheme

Encryption process

The encryption process, as shown in Fig. 2, can be implemented using some optoelectronic devices. The complex image and the chaotic random phase mask can be added to the optical path through spatial light modulators (SLM). The complex image is illuminated by an LED light source, and encoding with two CRPMs. The encoded image is then recorded by a CCD camera as a series of low-resolution encrypted images resembling noise. These images are stored in a computer using phase-shifting or off-axis digital holography techniques. The encryption process is mainly divided into the following steps:

Fig. 2
figure 2

Schematic of optical image encryption based on LED-illuminated Fourier ptychography and plaintext-related chaotic random phase mask

The encoded image is then recorded by a CCD camera as a series of low-resolution encrypted images resembling noise. These images are stored in a computer using phase-shifting or off-axis digital holography techniques.

Step 1: Using a plaintext image as the input amplitude and any image as the input phase, generated a high-resolution complex image of size 256 × 256 as the input original image \(I\). In which, the plaintext image represents the image we want to encrypt, while the other image is only used to construct the high-resolution complex image.

Step 2: Illuminate the LED and select a sub-region \(I_{N}\) in the Fourier domain of the original image \(I\), equivalent to a low-pass filter of the coherent imaging system. The position of the low-pass filter is selected to correspondingly illuminate different LED elements. \(I_{N}\) is modulated by two chaotic random phase masks CRPM1 and CRPM2 in the Fourier domain, which is expressed as:

$$IE_{N} = \left| {IFT\left( {CTF \cdot pupil\left( {IFT\left( {FT\left( {I_{N} \cdot CRPM_{1} } \right) \cdot CRPM_{2} } \right)} \right)} \right)} \right|$$
(8)

where, \(N = 1 \cdots 225\), \(CTF\) is the coherent optical transfer function of the objective lens, \(pupil\) is the pupil function for defocus aberration and the defocus distance is set to 10 µm, \(FT\left( \cdot \right)\) represents the Fourier transform, \(IFT\left( \cdot \right)\) represents the inverse Fourier transform, \(IE_{N}\) are encrypted images.

Step 3: Illuminate other LED elements, repeat step 2 until obtain encrypted images corresponding to all LED elements.

Decryption process

With the correct secret key, we can reconstruct and decrypt the original image using Fourier ptychography phase retrieval algorithm. The decryption process, as shown in Fig. 3, mainly consists of the following steps:

Fig. 3
figure 3

Flowchart of the LED-illuminated Fourier ptychography recovery algorithm

Step 1: The decryption process commences with an initial guess in spatial domain of the original image \(I_{g}\).

Step 2: The initial guess \(I_{g}\) is transformed to the Fourier domain obtain the Fourier spectrum of the initial guess.

Step 3: The reconstructed update sequence is configured according to the energy criteria, prioritizes images with higher total energy of the encrypted image. In this approach, we start from the image corresponding to the center of the Fourier spectrum (the image 113), and end with the image corresponding to the edge of the spectrum (the image 225). Following this order, we select subregions in the Fourier spectrum of \(I_{g}\) to obtain the target image \(I_{ti}\).

Step 4: The target image \(I_{ti}\) is modulated by the chaotic random phase mask CRPM1 and CRPM2 in the Fourier domain to obtain the scrambled target image \(I_{ti}\):

$$I^{'}_{u} = IFT\left( {FT\left( {I_{ti} \cdot CRPM_{1} } \right) \cdot CRPM_{2} } \right)$$
(9)

Step 5: Introducing the encrypted image \(IE_{N}\), the scrambled target image \(I_{ti}\) is updated by the following equation to obtain the updated scrambled target image \(I_{ti}{\prime}^{updated}\):

$$I_{ti}^{' updated} = FT\left( {IE_{N} \cdot exp\left( {1i \cdot angle\left( {I_{m} } \right)} \right)} \right) \cdot CTF \cdot \frac{1}{pupil}$$
(10)

where \(I_{m} = IFT\left( {I_{ti}{\prime} \cdot CTF \cdot pupil} \right)\).

Step 6: The updated scrambled target image \(I_{ti}{\prime}^{updated}\) is modulated by the conjugate of chaotic random phase mask CRPM1 and CRPM2 to obtain the updated target image \(I_{ti}^{updated}\):

$$I_{ti}^{updated} = IFT\left( {FT\left( {I_{ti}{\prime}^{updated} } \right) \cdot CRPM_{2}^{*} } \right)CRPM_{1}^{*}$$
(11)

Step 7: The updated target image \(I_{ti}^{updated}\) updates the estimate of the original image in the Fourier domain by:

$$FT\left( {I_{g}^{updated} } \right) = I_{ti}^{updated} + \left( {1 - CTF} \right) \cdot I_{g}$$
(12)

Step 8: The update process is repeated for all illumination angles, at which point the entire high-resolution image in Fourier space has been modified by all low-resolution intensity measurements.

Step 9: Repeat steps 3–8, usually we repeat this process 2–5 times.

Step 10: At the end of the above iterative recovery process, the convergent solution in Fourier space is converted back to the spatial domain, and the original image is reconstructed and decrypted.

Experiment Results and analysis

Feasibility analysis

In order to verify the feasibility, security and robustness of the proposed scheme. We conducted a series of simulation experiments using MATLAB 2018b. In these simulation experiments, the LED matrix contains 15 × 15 elements, resulting in a total of 225 different illumination angles. Set the initial value of the Lozi chaos map to \(x_{0} = 0.34\), \(y_{0} = 0\), the chaotic parameter is set to \(\alpha = 1.75\), \(\beta = 0.33\). The images to be encrypted is shown in Fig. 4a, so use Fig. 4a "Lena" as input amplitude and Fig. 4b "Peppers" as input phase to generate high-resolution input original images. Use Fig. 4a to generate two CRPMs as shown in Fig. 4c–d. We need to deal with two types of image dimensions in this experiment, namely 256 × 256 high-resolution image and 64 × 64 low-resolution image. The high-resolution input original image is encrypted into 225 low-resolution encrypted images by using two CRPMs and Fourier ptychography methods, two of the encrypted images shown in Fig. 4e–f. We can be found that there is no information about the original image in Fig. 4e–f. The amplitude part and phase part of the decrypted original image reconstructed with the correct keys are shown in Fig. 4g, h. The encryption process took 0.6725 s and the decryption process took 1.0345 s. To quantify the similarity between the original image and the decrypted image, the correlation coefficient (CC) and structural similarity (SSIM) are introduced. The larger the CC and SSIM, the more similar the two images are.

Fig. 4
figure 4

(a)–(b) The input amplitude and input phase of the high-resolution input original images, (c)–(d) CFPMs generated by (a), (e)–(f) two encrypted images, (g)–(h) the amplitude portion and phase portion of the original image decrypted with the correct keys

The CC is defined as:

$$CC\left( {I,I_{d} } \right) = \frac{{E\left\{ {\left[ {I - E\left( I \right)} \right]\left[ {I_{d}^{{}} - E\left( {I_{d}^{{}} } \right)} \right]} \right\}}}{{\left\{ {E\left\{ {\left[ {I - E\left( I \right)} \right]^{2} } \right\}} \right\}\left\{ {E\left\{ {\left[ {I_{d}^{{}} - E\left( {I_{d}^{{}} } \right)} \right]^{2} } \right\}} \right\}^{\frac{1}{2}} }}$$
(13)

where \(I\) is the original image, \(I_{d}^{{}}\) is the decrypted image, E{∙} is an expectation operator.

The SSIM is defined as:

$$SSIM\left( {I,I_{d} } \right) = \frac{{\left( {2\mu_{I} \mu_{{I_{d} }} + C_{1} } \right)\left( {2\sigma_{{II_{d} }} + C_{2} } \right)}}{{\left( {\mu_{I}^{2} + \mu_{{I_{d} }}^{2} + C_{1} } \right)\left( {\sigma_{I}^{2} + \sigma_{{I_{d} }}^{2} + C_{2} } \right)}}$$
(14)

where \(\mu_{I}\) and \(\mu_{{I_{d} }}\) denote the mean of the image \(I\) and \(I_{d}^{{}}\), respectively; \(\sigma_{I}\) and \(\sigma_{{I_{d} }}\) denote the variance of the image \(I\) and \(I_{d}^{{}}\), respectively; \(\sigma_{{II_{d} }}\) denotes the covariance of the image \(I\) and \(I_{d}^{{}}\); and C1 and C2 are two constants.

The visual observation of Fig. 4a, g shows that they are very similar. The CC value between them is 0.9994, the SSIM value between them is 0.9963, indicating that the original image can be well restored.

Security analysis

In order to verify the security of the scheme proposed in this paper, the wrong keys are used in decryption process. First, use the image shown in Fig. 5a (change the generated initial values \(x\),\(y\)) to generate the CRPMs, the original initial value is still set to \(x_{0} = 0.34\), \(y_{0} = 0\) and the chaotic parameter is still set to \(\alpha = 1.75\), \(\beta = 0.33\). The generated CRPMs are shown in Fig. 5b–c. The amplitude portion and phase portion of the original image reconstructed and decrypted using the CRPMs shown in Fig. 5b–c is shown in Fig. 5d–e. The CC and SSIM between Figs. 4a and 5d are 0.0047 and 0.0029. It can be seen that when the plaintext image is wrong, the valid original image cannot be recovered.

Fig. 5
figure 5

(a) “Cameraman” image, (b)–(c) CRPMs generated by (a), (d)–(e) the amplitude portion and phase portion of the original image decrypted using error CRPMs

Secondly, use the wrong chaotic original initial value and parameters of Lozi map to decrypt. Figure 6 respectively represent the amplitude portion and phase portion of the original image decrypted with one incorrect chaotic original initial value or parameters, respectively. The CC between Figs. 6a, c, e, g and  4a are 0.0038, 0.0033, 0.0026 and 0.0067. The SSIM between Figs. 6a, c, e, g and 4a are 0.0021, 0.0055, 0.0013 and 0.0019. It can be seen from the above results that the effective original image cannot be recovered even if any of the chaotic original initial values and parameters change slightly. Therefore, the chaotic original initial values and parameters can be used as the secret keys of the image encryption scheme proposed in this paper.

Fig. 6
figure 6

The amplitude portion and phase portion of the original image decrypted using one incorrect chaotic original initial value or parameters (a)–(b) \(x_{0}^{\prime} = 0.34 + 10^{ - 15}\), (c)–(d) \(y_{0}^{\prime} = 0 + 10^{ - 15}\), (e)–(f) \(\alpha^{\prime} = 1.75 + 10^{ - 15}\), (g)–(h) \(\beta^{\prime} = 0.33 + 10^{ - 15}\)

In addition, attackers may use statistical analysis methods to infer the content or key information of images, in order to test the robustness of the image encryption scheme proposed in this paper against statistical analysis attacks. As shown in Fig. 7, we first plot histograms of the original image and two randomly selected encrypted images. It can be seen from Fig. 7a–c that the histogram of the original image has more peaks and fluctuations, while the histogram of the encrypted images exhibits more uniform characteristics, and there are obvious differences between them. We also randomly select 1000 pairs of adjacent pixels from the horizontal, vertical and diagonal directions of the original image and the two encrypted images, and use the formula in Ref. [38] to calculate the correlation coefficient between adjacent pixels, as shown in Table 1. Furthermore, Fig. 8 shows the correlation between adjacent pixels of the original image and the two encrypted images in three directions. It can be seen that the correlation of adjacent pixels in the three directions of the original image is strong, while the correlation of adjacent pixels in the three directions of the two encrypted images is extremely low. Therefore, the image encryption scheme proposed in this paper is highly robust to statistical analysis attacks.

Fig. 7
figure 7

(a) Original image and histogram, (b)–(c) two encrypted images and histograms

Table 1 The correlation coefficients between adjacent pixels in original image and two encrypted images selected randomly
Fig. 8
figure 8

Correlations between adjacent pixels in horizontal, vertical, and diagonal directions (a)–(c) original image, (d)–(i) two encrypted images

Robustness analysis

Encrypted images may be subject to noise pollution or data loss during transmission. To test the robustness of the proposed image encryption scheme against noise attacks in this paper, noise is introduced in the following manner:

$$IE^{\prime} = IE + \left( {1 + K \bullet G} \right)$$
(15)

where, \(IE{\prime}\) represents the attacked encrypted images, K represents the embedding intensity, and G represents generated noise. In the experiments, we utilized Gaussian noise, speckle noise, and salt & pepper noise. We added noise at 20%, 40%, and 60% (45 images, 90 images, 135 images) levels to 225 encrypted images. The decrypted images obtained with the correct keys when the embedding intensity K is 0.1, 0.2, 0.3, respectively, are shown in Figs. 9, 10 and 11. The CC and SSIM corresponding to the decrypted image and the original image are shown in Tables 2, 3, 4, 5, 6 and 7. The above results show that when the noise embedding intensity is constant, the quality of decrypted images deteriorates with the increase of the number of noise-polluted encrypted images. Similarly, when the number of noise-polluted encrypted images is constant, the quality of decrypted images deteriorates with the increase of noise embedding intensity. However, when the noise embedding intensity is increased to 0.3 and 60% (135 images) of the encrypted images are contaminated, the original images can still be recovered well. Therefore, the image encryption scheme proposed in this paper has high robustness against noise attacks.

Fig. 9
figure 9

Decrypted images from the Gaussian noise contaminated encrypted images

Fig. 10
figure 10

Decrypted images from the salt & pepper noise contaminated encrypted images

Fig. 11
figure 11

Decrypted images from the speckle noise contaminated encrypted images

Table 2 CC values between original image and decrypted image with Gaussian noise attack
Table 3 SSIM values between original image and decrypted image with Gaussian noise attack
Table 4 CC values between original image and decrypted image with salt & pepper noise attack
Table 5 SSIM values between original image and decrypted image with salt & pepper noise attack
Table 6 CC values between original image and decrypted image with speckle noise attack
Table 7 SSIM values between original image and decrypted image with speckle noise attack

During the transmission of encrypted images, partial data loss may occur. We conducted the following simulation experiments to verify the robustness of the image encryption scheme proposed in this paper against data loss. Similarly, we randomly selected 20%, 40%, and 60% (45 images, 90 images, 135 images) of the 225 encrypted images and set some pixel values of the selected images to 0 to simulate data loss. When the data loss rate is 5%, 10%, 15%, the decrypted images obtained by using the correct keys are shown in Fig. 12. The CC and SSIM corresponding to the decrypted image and the original image are shown in Tables 8 and 9. The above results show that when the ratio of data loss is constant, the quality of decrypted images deteriorates with the increase of the number of encrypted images with data loss. Similarly, when the number of encrypted images with data loss is constant, the quality of decrypted images deteriorates with the increase of the proportion of data loss. However, when the data loss rate is increased to 25% and 60% of the encrypted images are subject to data loss attacks, the original images can still be recovered well. Therefore, the image encryption scheme proposed in this paper has high robustness against data loss attacks.

Fig. 12
figure 12

Decrypted images from data loss attack

Table 8 CC values between original image and decrypted image with data loss attack
Table 9 SSIM values between original image and decrypted image with data loss attack

Conclusions

This paper presents an optical image encryption based on LED-illuminated Fourier ptychography and plaintext-related chaotic random phase mask. In this image encryption scheme, the plaintext-related CRPMs are generated by chaotic Lozi map and secure hash algorithm. During the encryption process, the input original image undergoes encryption, resulting in a series of noise-like low-resolution images using two CRPMs and Fourier ptychography methods. In the decryption process, the input original image can be reconstructed and decrypted from a series of low-resolution encrypted images by using Fourier ptychography phase retrieval algorithm with correct keys. In this proposed encryption scheme, the initial values and parameters of the chaotic system, which dependent on plaintext, replace the random phase masks as the keys. The random phase masks are used as intermediate variables, facilitating the transmission and management of secret keys. In addition, the chaotic parameter keys are associated with the plaintext image. When the plaintext image changes, the chaotic parameter keys can be dynamically updated in real time, the security of the image encryption scheme is further improved. The experimental results indicate that the image encryption scheme proposed in this paper can successfully recover high-resolution complex amplitude images as the original image, has high feasibility. In cases of any incorrect key, it is impossible to recover a valid original image, ensuring a high level of security. Additionally, the image encryption scheme is also highly robust against statistical attacks, noise pollution and data loss attacks.