Optical image encryption based on real-valued coding and subtracting with the help of QR code

Optical image encryption based on real-valued coding and subtracting with the help of QR code

Optics Communications 349 (2015) 48–53 Contents lists available at ScienceDirect Optics Communications journal homepage: www.elsevier.com/locate/opt...

2MB Sizes 1 Downloads 61 Views

Optics Communications 349 (2015) 48–53

Contents lists available at ScienceDirect

Optics Communications journal homepage: www.elsevier.com/locate/optcom

Optical image encryption based on real-valued coding and subtracting with the help of QR code Xiaopeng Deng Department of Physics and Information Engineering, Huaihua University, Huaihua 418008, China

art ic l e i nf o

a b s t r a c t

Article history: Received 10 February 2015 Received in revised form 16 March 2015 Accepted 19 March 2015 Available online 20 March 2015

A novel optical image encryption based on real-valued coding and subtracting is proposed with the help of quick response (QR) code. In the encryption process, the original image to be encoded is firstly transformed into the corresponding QR code, and then the corresponding QR code is encoded into two phase-only masks (POMs) by using basic vector operations. Finally, the absolute values of the real or imaginary parts of the two POMs are chosen as the ciphertexts. In decryption process, the QR code can be approximately restored by recording the intensity of the subtraction between the ciphertexts, and hence the original image can be retrieved without any quality loss by scanning the restored QR code with a smartphone. Simulation results and actual smartphone collected results show that the method is feasible and has strong tolerance to noise, phase difference and ratio between intensities of the two decryption light beams. & 2015 Elsevier B.V. All rights reserved.

Keywords: Optical image encryption Real-valued coding Subtracting Quick response (QR) code

1. Introduction Over the last few decades, due to the characteristics of highspeed and paralleling, optical image encryption techniques have been receiving more and more attention since Refregier and Javidi first proposed the double random phase encoding (DRPE) technique [1]. Many improved DRPE techniques have been proposed in fractional Fourier and Fresnel domains [2–5], which enhanced the security of the techniques with extra keys such as wavelength and distance. However, these DRPE techniques involve a complex ciphertext, which is not very convenient for optical encryption because spatial light modulators are not able to modify the amplitude and the phase simultaneously. To overcome this issue, a lot of techniques, for example phase retrieval algorithm [6–9], basic vector operations [10,11], interference-based technique [12], have been proposed to encode an image into POMs. However, these encryption methods also face a realistic issue, i.e. how to conveniently store or record these POMs in the real-world. Since these POMs are complex, which makes it difficult to print directly or manufacture a card, it is not very convenient for users to store and transfer them in the real-world and these encryption systems need highly sophisticated optoelectronic devices to record or represent the complex values, which could limit practical application outside the laboratory. In addition, although most of the optical encryption techniques E-mail address: [email protected] http://dx.doi.org/10.1016/j.optcom.2015.03.047 0030-4018/& 2015 Elsevier B.V. All rights reserved.

are suited for gray scale image as well as binary image in theory, the quality of the optical experiment results corresponding to gray scale image is very poor because of speckle noise and other noises resulting from optical system, which is just the main reason why potentials user are reluctant to accept the optical protocols. Fortunately, Barrera et al. recently successfully settled the problem by merging the QR code to the optical encryption [13,14]. In their method, the original image to be encoded is converted into the corresponding QR code before a standard optical encrypting procedure. As a result, the original information could be retrieved without any quality loss because QR codes have strong tolerance to speckle noise and other noises resulting from optical system. Since QR code in fact is a binary image which itself has stronger tolerance to all kinds of noises than gray scale image, it is more meaningful to develop optical information security technique for binary image. In this paper, with the help of the QR code, a novel optical image encryption based on real-valued coding and subtracting is proposed. In encryption process, the original image is firstly transformed into the corresponding QR code, and then the QR code is encoded into two POMs by using basic vector operations [10]. In order to realize real-valued coding, the absolute values of the real or imaginary parts of the two POMs are chosen as the ciphertexts. In decryption process, the QR code can be approximately restored by recording the intensity of the subtraction between the two ciphertexts. Although the quality of the recovered QR code is somewhat degraded, the original image still can be

X. Deng / Optics Communications 349 (2015) 48–53

49

retrieved without any quality loss because QR codes are tolerant to speckle noise and other noises resulting from optical system. Compared with most of the reported encryption methods [1– 12,15,16], in which the ciphertexts are usually complex numbers, the ciphertexts of the proposed method are real-valued data and can be printed directly or manufactured as a card, which makes it very convenient for users to store and transfer them in the realworld. Moreover, with the help of QR code, gray scale image also can be encrypted and decrypted without any quality loss. This paper is organized as follows. The encryption and decryption procedure is presented in Section 2. The simulation results and discussions are given in Section 3 and a brief conclusion is included in Section 4. Fig. 1. Basic vector addition operation; Im: imaginary part; Re: real part.

2. Method description First, let us show how to encode an image into two real-valued images by using basic vector operations [10]. As shown in Fig. (1), →

a complex number g0 , of which the modulus is denoted by I , can be viewed as a position vector in a two-dimensional Cartesian coordinate system, in which the real part is used as the horizontal component and imaginary part as vertical. Based on the summa-

I (x, y) denotes the QR code corresponding to the original image to be encoded, we can readily encode it into two phase-only images z1 (x, y) and z2 (x, y) by the above algorithm. As can be seen from Eq. (1), the QR code can be readily restored by recording the intensity of the coherence superposition of z1 (x, y) and z2 (x, y) , which can be denoted by

|z1 (x, y) + z2 (x, y) |2 = |1 + exp iθ (x, y) |2 = I (x, y).

(6)



tion rule of vectors, the complex number g0 also can be taken as the sum of two vectors and expressed as →





g0 = z1 + z2. The angle θ between

(1) → z1

and

→ z2

can be readily computed by

→ → I − | z1|2 − | z2 |2 , θ = arccos → → 2| z1|| z2 |

(2)

where |∙| denotes the modulus operation. →

According to the triangle inequality, the modulus of g0 is within → → → → → → the range of || z1| − | z2 || to | z1| + | z2 |. Suppose that z1 and z2 are two →

unit vectors, the modulus of g0 should be within the range of 0–2. Conversely, any vector of which modulus is smaller than 2 can be always divided into two unit vectors. Under these circumstances, Eq. (2) can be rewritten as

θ = arccos(

(3) → z1

→ It can be seen from Eq. (3) that the angle θ between and z2 → can be determined as long as we know the modulus of g0 . So it → → does not matter where the vector z1 or z2 is placed. Assume that → → the phase of the unit vector z1 is exp iα , the other unit vector z2 can be expressed as

(4)

Since a pixel value of an image can be represented by a complex number, it is possible for us to divide an image into two phase→ only masks. When g0 denotes a pixel value of an image of which → modulus is expressed by I (x, y) and z1 represents a pixel value of a random phase image expressed by exp[iα (x, y)], we can obtain the another phase-only image based on Eq. (4), which can be expressed by

z2 (x, y) = exp{i [α (x, y) + θ (x, y)]},

z AR1 (x, y) = |cos α (x, y) | ,

(7)

and

z AR2 (x, y) = |cos [α (x, y) + θ (x, y)] | .

I − 1). 2

→ z2 = exp[i (α + θ)].

However, although the QR code can be accurately retrieved without any noise, the two phase-only images are complex numbers, which makes it inconvenient for users to store, transfer and represent them in the real-world. So we do not choose the two phase-only images as the ciphertexts in our method. The method of which aim is to realize real-valued coding is based on the conclusion that an acceptable decrypted result can be obtained when only partial data of the two phase-only images are used in the decryption process. Therefore, we discuss the restoration by taking only partial data in the following. Since the two phase-only images are complex function, we can choose the absolute values of the real parts of the two phase-only images as the ciphertexts, which can be expressed respectively by

(5)

where I (x, y) is within the range of 0–4 according to the triangle inequality, and α (x, y) is a random function distributed uniformly in the interval [0, 2π]. Obviously, z2 (x, y) is also close to a random phase image because α (x, y) is a random function. That is to say, we cannot obtain any information of I (x, y) only from z2 (x, y) . If

(8)

But the problem is whether the QR code can be restored only by using z AR1 (x, y) and z AR2 (x, y) . In the following, we will analyze this problem based on optical image subtraction. Based on Eq. (3), the intensity of the subtraction between z AR1 (x, y) and z AR2 (x, y) can be expressed by

f ‵ (x, y) = |z AR2 (x, y) − z AR1 (x, y) |2 = || cos [α (x, y) + θ (x, y)] | − | cos α (x, y) ||2 =

cos α (x, y)(

1−(

I (x , y ) − 1) − sin α (x, y) . 2

I (x , y ) − 1)2 ] − | cos α (x, y) | 2

2

(9)

Since I (x, y) denotes the QR code which in fact is a binary image, the above Eq. (9) can be further expressed as

⎧1 − | sin 2α (x, y) | when I (x, y) = 2 . f ‵ (x , y ) = ⎨ 0 when I (x, y) = 0 ⎩

(10)

It should be pointed out that in order to obtain the above equation the maxima of the QR code I (x, y) is changed from 1 to 2 in advance when we calculate the angle θ (x, y) by Eq. (3). It can be seen from Eq. (10) that the areas of which the pixel values are

50

X. Deng / Optics Communications 349 (2015) 48–53

the current resource limitation in our laboratory, we just made some numerical simulations to verify the feasibility and effectiveness of the proposed method.

3. Simulation results and discussion

Fig. 2. All-optical decryption setup; M1, M2: Mirrors; BS1, BS2: Beam splitters; HP: Half-wave plate; f: Focal length of imaging lens.

0 can be accurately restored by recording the intensity of the subtraction between z AR1 (x, y) and z AR2 (x, y), while the areas of which the pixel values are 2 cannot be correctly restored and superposed by a random noise | sin 2α (x, y) |. Even so, the information hidden in the QR code still can be interpreted by a smartphone or a tablet equipped with the correct reader application because binary image itself has stronger tolerance to noise than gray scale image and QR code is tolerant to random noise, which can be seen from the following simulation results. In addition, binarization processing can be applied to the restored QR code with an appropriate threshold if the quality is too poor to read by a smartphone. It is worth pointing out that the absolute values of the imaginary parts of the two phase-only images also can be chosen as the ciphertexts, by which the result obtained is the same as that obtained by the real parts. It is worth pointing out that although the formation process of the ciphertexts must be realized digitally in computer, the decryption process is very simple and can be implemented by using all-optical devices shown in Fig. 2, where M, BS, and HP denote plane mirror, beam splitter, and half-wave plate, respectively. The HP is used to introduce a phase shift of π so as to realize optical subtraction. First, the two ciphertexts (i.e. z AR1 (x, y) and z AR2 (x, y)), which are generated by computer, are placed in the two object planes, respectively. It should be noticed that in order to avoid an upside down image one of the two ciphertexts (for example z AR1 (x, y) ) must be placed upside down. Due to the inverted effect of the BS2, the other ciphertext (i.e.z AR2 (x, y) ) need not be placed upside down. Then the two corresponding images can be obtained respectively by the two imaging lenses in the image plane. When the aperture of the imaging lens is much larger than the size of image, the two corresponding images, obtained by the two imaging lenses, can be expressed respectively as ‵ z AR1 (x, y) = exp(iϕ (x, y) ∙z AR1 (x, y)

(11)

and ‵ z AR2 (x, y) = exp(iπ) ∙ exp(iϕ (x, y) ∙z AR2 (x, y),

(12)

where exp(iϕ (x, y) is a quadratic phase factor, and exp(iπ) is introduced by the half-wave plate (HP). Thus the retrieved QR code can be approximately obtained in the image plane by recording the intensity of coherence superposition of the two images, which can be expressed as ‵ ‵ f ‵ (x, y) = |z AR2 (x, y) + z AR1 (x, y) |2 = |z AR2 (x, y) − z AR1 (x, y) |2 .

(13)

Finally, the original image can be accurately restored by scanning the restored QR code with a smartphone. However, owing to

Computer simulations are performed to verify the efficiency of the proposed approach. A gray scale image comprising 256  256 pixels, as shown in Fig. 3(a), is used as the original image to be encoded. The corresponding QR code is shown in Fig. 3(b), which is also with the size of 256  256 pixels. Figures. 3(c) and (d) show the final two encoded images (i.e. ciphertexts), respectively, which look like random white noise. The correctly decrypted QR code is shown in Fig. 3(e). To objectively estimate the decryption results, we calculate the correlation coefficient (CC) between the recovered image f ′ (x, y) and the primary image f (x, y), which is defined as

CC =

E {[f − E (f )][f ‵ − E (f ‵)]} E {[f − E (f )]2 } E {[f ‵ − E (f ‵)]2 }

, (14)

where E [∙] is the expectation value and the coordinates are omitted for brevity. The CC value between the original and the restored QR code is 0.7774, which shows a satisfactory retrieval. The result obtained by scanning Fig. 3(e) with a smartphone is shown in Fig. 3(f). It can be seen that the information hidden in the QR code was retrieved without any quality loss. Generally, encryption algorithm requires that any information about the secret image cannot be obtained when only one of the ciphertexts is employed for decryption. In order to verify whether the requirement is satisfied, we also perform some corresponding numerical simulations. Fig. 4 shows the results obtained when one of the two ciphertexts is replaced by a constant function or a random positive function and the other one is used in decryption. It is clear from Fig. 4 that the results look like white noises, which fully illustrates that in our algorithm any information about the secret image cannot be obtained by using only one of the ciphertexts in decryption. As we know, in the optical decryption setup shown in Fig. 2, the decrypted results are always affected by various factors such as speckle noise, phase difference and ratio between intensities of the two decryption light beams and so on. To test the robustness of our method, we further study the sensitivity of the recovered QR code to noise, phase difference and ratio between intensities of the two decryption light beams. First, we evaluate the influence of noise on the recovered QR code. It can be seen from Eq. (10) that although the areas of which the pixel values are 2 will be affected by multiplicative noise, the areas of which the pixel values are 0 will not be affected. So multiplicative noise has little influence on decrypted result and can be disregard, which can be seen from Figs. 5(a) and (f), where the restored QR code is corrupted by zeromean multiplicative speckle noise with a variance of 0.9, and the CC value between the original and the restored QR code is 0.6086. However, the whole areas of the restored QR code will be affected by additive noise. Figs. 5(b)–(d) show the restored QR codes which are corrupted by zero-mean additive speckle noise with different variances, respectively. By a series of simulation experiments, we find that the original image still can be successfully displayed by scanning the corrupted QR codes, as shown in Fig. 5(f). In addition, we can carry on binarization processing for the corrupted QR code with an appropriate threshold before scanning it if the quality is too poor to scan with a smartphone. Fig. 5(e) shows the binarization result of Fig. 5(d). It can be seen from the above simulation results that although the noise, especially the additive noise, makes a degradation of the decryption QR code in quality, the

X. Deng / Optics Communications 349 (2015) 48–53

51

Fig. 3. Encryption and decryption results: (a) the original image; (b) the QR code corresponding to the original image; (c) and (d) the final encoded images: z AR1 (x, y) and z AR2 (x, y) ; (e) the retrieved QR code; (f) the outcome obtained by scanning the retrieved QR code with a smartphone.

information hidden in the QR code still can be retrieved without any quality loss because the QR code has strong tolerance to speckle noise. In this section, we will discuss the influence of phase difference and ratio between intensities of the two decryption light beams on the restored QR code. It can be seen from Eqs. (9) and (10) that the restored QR code will be influenced when the phase difference and the ratio between intensities of the two decryption light beams are not equal to π and 1, respectively. First, to determinate the sensitivity of the recovered QR code to phase difference, we change the phase difference from π/2 to 3π/2. The corresponding CC between the original and the restored QR code is shown in Fig. 6(a), which indicates that although the quality of the restored QR code is sensitive to the phase difference, the original image still can be retrieved without any quality loss by scanning the restored QR code with a smartphone when the phase difference is within the range of 2.4–3.9 rad. Similarly, we change the ratio from 0.01

to 1. The corresponding CC between the original and the restored QR code is shown in Fig. 6(b), which indicates that the CC decreases as the ratio decreases. However, the original image also can be retrieved without any quality loss by scanning the restored QR code when the ratio is not less than 0.7. Here it should be pointed out that the above results are based on an approximate hypothesis that the original image can be readily displayed by scanning the restored QR code when the CC value is larger than 0.5, while the original image cannot be readily displayed by scanning the restored QR code when the CC value is less than 0.5. So here 0.5 is used as a threshold of the CC value based on the hypothesis which is verified by our experiments. In practice, when the CC value is less than 0.5 and close to 0.5, the original image still can be displayed, but more scan time is needed. It can be seen from the above discussions that the proposed method has strong tolerance to speckle noise, phase difference and ratio between intensities of the two decryption light beams.

Fig. 4. Results obtained (a) when ciphertext z AR1 (x, y) is replaced by a constant function and the other ciphertext z AR2 (x, y) is used in decryption; (b) when ciphertext z AR2 (x, y) is replaced by a constant function and the other ciphertext z AR1 (x, y) is used in decryption; (c) when ciphertext z AR1 (x, y) is replaced by a random positive function and the other ciphertext z AR2 (x, y) is used in decryption and (d) when ciphertext z AR2 (x, y) is replaced by a random positive function and the other ciphertext z AR1 (x, y) is used in decryption.

52

X. Deng / Optics Communications 349 (2015) 48–53

Fig. 5. Decryption results corrupted by (a) zero-mean multiplicative speckle noise with a variance of 0.9, (b) zero-mean additive speckle noise with a variance of 0.1, (c) zeromean additive speckle noise with a variance of 0.5, (d) zero-mean additive speckle noise with a variance of 0.6; (e) the binarization result of (d); (f) the outcome obtained by scanning (a)–(e) with a smartphone.

In addition, we also discuss the tolerance to the occlusion attack of the transmission channels. Based on decryption principle, there is a one to one relationship between pixels of the restored QR code and the two ciphertexts. In other word, the occlusions of some pixels in the ciphertexts will result in losses of the corresponding pixels in the restored QR code. So in this encryption technique the tolerance to the occlusion attack is completely determined by QR code. Although QR code has certain error correcting capability the areas of which the pixels possess error correcting capability are very uneven distribution. The error correcting capability of the areas in which the three locating boxes are located is weaker than that of the other areas, as shown in Fig. 7. Fig. 7(a) shows the restored QR code with 1.6% of occlusion. On

this occasion, the restored QR code cannot be recognized by smartphone because the blocked area is corresponding to the locating box. Figs. 7(b) and (c) show the restored QR codes with 10% of occlusion. Under this circumstance, the restored QR codes still can be recognized by smartphone because the blocked areas are not corresponding to the locating box, but more scan time is needed. However, when 15% of occlusion is occurred the restored QR code will no longer be recognized by smartphone, as shown in Fig. 7(d). It can be seen from the above discussions that the encryption algorithm has weak tolerance to occlusion attack, especially for the areas in which the three locating boxes are placed.

Fig. 6. CC variation versus (a) phase difference, and (b) ratio between intensities of the two decryption light beams.

X. Deng / Optics Communications 349 (2015) 48–53

53

Fig. 7. Tolerance to occlusion attack: (a) the restored QR code obtained when 1.6% of occlusion is occurred and the blocked area is corresponding to the locating box, (b) the restored QR code obtained when 10% of occlusion is occurred and the blocked area is located in the middle area, (c) the restored QR code obtained when 10% of occlusion is occurred and the blocked area is located in the lower-right corner, and (d) the restored QR code obtained when 15% of occlusion is occurred and the blocked area is located in the middle area.

4. Conclusions In summary, a novel optical image encryption based on realvalued coding and subtracting is proposed with the help of the QR code. Compared with most of the reported encryption methods, in which the ciphertexts are usually complex numbers, the ciphertexts of the proposed method are real-valued data and can be printed directly or manufactured as a card, which makes it very convenient for users to store and transfer them in the real-world. Moreover, with the help of QR code, gray scale image also can be encrypted and decrypted without any quality loss. In addition, the decryption process is very simple and can be implemented by using all-optical devices. Simulation results show that the method is feasible and has strong tolerance to noise, phase difference and ratio between intensities of the two decryption light beams.

Acknowledgments This work was supported by the Hunan Provincial Natural Science Foundation of China under Grant no. 14JJ2129 and the

National Natural Science Foundation of China under Grant no. 11474120.

References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

P. Refregier, B. Javidi, Opt. Lett. 20 (1995) 767. G. Unnikrishnan, J. Joseph, K. Singh, Opt. Lett. 25 (2000) 887. G. Situ, J. Zhang, Opt. Lett. 29 (2004) 1584. G. Unnikrishnan, K. Singh, Opt. Eng. 39 (2000) 2853. W. Wang, D. Zhao, L. Chen, Opt. Commun. 260 (2006) 449. E.G. Johnson, J.D. Brasher, Opt. Lett. 21 (1996) 1271. X. Deng, D. Zhao, Opt. Lasers Technol. 44 (2012) 374. B. Hennelly, J.T. Sheridan, Opt. Commun. 226 (2003) 61. X. Deng, D. Zhao, Appl. Opt. 50 (2011) 6019. X. Wang, D. Zhao, Opt. Commun. 284 (2011) 945. X. Wang, D. Zhao, Opt. Commun. 285 (2012) 4280. Y. Zhang, B. Wang, Opt. Lett. 33 (2008) 2443. J.F. Barrera, A. Mira, R. Torroba, Opt. Express 21 (2013) 5373. J.F. Barrera, A. Mira, R. Torroba, Opt. Lett. 39 (2014) 3074. Y. Qin, Q. Gong, Opt. Commun. 310 (2014) 69. W. Chen, X. Chen, Appl. Opt. 51 (2012) 6076.