SECURE QR CODE USING NONLINEARITY OF SPATIAL FREQUENCY IN LIGHT
20200184293 ยท 2020-06-11
Inventors
Cpc classification
H04L63/0428
ELECTRICITY
G06K7/1491
PHYSICS
G06K19/0614
PHYSICS
G06F21/606
PHYSICS
International classification
Abstract
This invention relates to a secure QrCode communication method based on nonlinear spatial frequency characteristics, comprising: camera modeling: modeling according to the spatial frequency of the color filter matrix of the scanning device's camera; QrCode encryption: using the CFA spatial frequency of scanning device and modeling results, as well as the spatial frequency of the display device, generate an encrypted picture of the target QrCode on the display device; QrCode decryption: the camera of the scanning device takes the picture of the display at a specified position and a specified angle, and parses the image to recover the target QrCode. Compared with the prior art, the present invention utilizes the nonlinear characteristics of the optical spatial frequency, and uses the spatial frequency of the camera's own color filter array and the spatial frequency of the display to modulate the target two-dimensional code through phase to achieve the effect of encryption.
Claims
1. A secure QrCode communication method based on nonlinear spatial frequency is characterized by the following three parts: Camera modeling: modeling based on the spatial frequency of the color filter array of the scanning device's camera; QrCode encryption: using the CFA spatial frequency of the scanning device's camera and its modeling result, and the spatial frequency of the display device, to generate an encrypted picture of the QrCode on the display device; QrCode decryption: The camera of the scanning device captures the encrypted QrCode shown on the display at a specified position and a specified angle, analyzes the target QrCode and recovers it.
2. According to claim 1, the secure QrCode communication method based on nonlinear spatial frequency is characterized that the modeling process specifically models the color filter array of the green filter layer.
3. According to claim 2, the secure QrCode communication method based on nonlinear spatial frequency is characterized wherein the modeling result is:
m.sub.cfa(x,y)=p.sub.cfa(.sub.cfa(x,y))
p.sub.cfa(u)=0.5+0.5 cos(2u)
.sub.cfa(x,y)=((x,y)mod 2)/2 Where, m.sub.cfa(x,y) is the green receiving information of the green filter layer on the camera image sensor at coordinates (x,y), p.sub.cfa() is the periodic function of the green filter layer in the CFA, and .sub.cfa (x,y) is the phase function of the green filter layer.
4. According to claim 1, the secure QrCode communication method based on the nonlinear spatial frequency is characterized wherein the QrCode encryption process specifically comprises: Step A1: performing phase and frequency modulation on the original QrCode image picture by using the CFA spatial frequency of the scanning device's camera and the modeling result, and the spatial frequency of the display device; Step A2: Add Gaussian white noise to the modulated picture to blur the contour in the encrypted QrCode.
5. According to claim 3, the secure QrCode communication method based on the nonlinear spatial frequency is characterized wherein the QrCode decryption process specifically comprises: Step B1: acquiring a plurality of consecutive pictures captured by the camera in the specified position and the specified angle to encrypt the QrCode in the display; Step B2: selecting an unprocessed image and converting the RGB image to the HSV coordinates to maximize the saturation dimension; Step B3: according to the positions of the three positioning marks, determining the size of the QrCode and dividing the QrCode for the converted picture to obtain a plurality of blocks; Step B4: extracting a green square, for each pixel point, when the green intensity is greater than a predetermined threshold, it is judged to be white, and vice versa, it is judged to be black; Step B5: for each square, determine the color of the square according to the distribution of white and black pixel points in the square; Step B6: traversing all the black squares and mark all adjacent black squares to the same index value; Step B7: determining whether all the blocks are marked or unmarked squares are all surrounded by the marked blocks, if yes, proceed to step B8, otherwise, return to step B2; Step B8: coloring according to the index value of each block, if two adjacent squares have the same index value, they are colored into the same color, and vice versa.
6. According to claim 5, the secure QrCode communication method based on the nonlinear spatial frequency is characterized, wherein the step B6 specifically comprises: Step B61: traversing all the black squares, and determining an index value of each block under the frame based on the principle that all adjacent black squares mark the same index value; Step B62: determining whether the index value exists in each block, and if not, the index value of the block in the current frame is used as the index value of the block, otherwise, step B63 is performed. Step B63: determining whether the index value of the block in the current frame is consistent with the previous index value. If not, all the blocks marked with the index value of the block in the previous frame are marked with the index value of the block under the frame.
7. According to claim 5, the secure QrCode communication method based on the nonlinear spatial frequency is characterized, wherein the step B8 specifically includes: Step B81: coloring the squares in the three positioning mark areas; Step B82, based on the coloring result of the squares in the three positioning areas, coloring according to the index values of the blocks, if the two adjacent squares have the same index value, the colors are colored the same color, and vice versa.
8. According to claim 1, the secure QrCode communication method based on nonlinear spatial frequency is characterized, wherein the designated position is between 20 and 45 centimeters from the display.
9. According to claim 8, a secure QrCode communication method based on nonlinear spatial frequency is characterized, wherein said designated position is 30 cm from the display.
10. According to claim 1, the secure two-dimensional code communication method based on nonlinear spatial frequency is characterized, wherein the specified angle is perpendicular to an angle of the display plane.
Description
BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
DETAILED DESCRIPTION OF THE INVENTION
[0049] The invention will be described in detail below with reference to the drawings and specific embodiments. This embodiment is implemented on the premise of the technical solution of the present invention, and detailed implementation manners and specific operation procedures are given, but the scope of protection of the present invention is not limited to the following embodiments. To solve the security problem, we propose mQRCode, which encrypts and decrypts the QR code using nonlinear features of optically specific spatial frequencies. When the target receiver holds the camera at the specified position (for example, 30 cm and 0), the encrypted QR code will be revealed as the original QrCode due to the mole phenomenon. A malicious attacker will only see the encrypted camouflage QrCode anywhere else. Our experiments show that the decryption rate of mQRCode is 95% and the average decoding rate is above 0.82 seconds. When the camera is 10 cm or 15 away from the specified position, the decoding rate drops to zero. So it directly isolates the attacker's attack and is a secure means of communication. A secure QrCode communication method based on nonlinear spatial frequency characteristics, as shown in
[0050] In the encryption process, more specific, because the camera's color filter array (
[0051] Camera Modeling: Modeling based on the spatial frequency of the camera's color filter matrix of the scanning device, where the camera color filter matrix parameters of the scanning device are known. The present application utilizes nonlinear optical interaction between the color filter matrix of the camera and the camouflage pattern to encrypt and decrypt the two-dimensional code. We assume that the spatial model of the color filter matrix is m.sub.cfa(x,y) and the original two-dimensional code is m.sub.dec(x,y). The encryption process is to calculate the encrypted two-dimensional code model m.sub.enc(x,y) to satisfy: m.sub.sec (x,y)=m.sub.cfa(x,y)*m.sub.enc(x,y). First, we need to model the color filter matrix, m.sub.cfa (x,y)=p.sub.cfa (.sub.cfa(x,y)).
m.sub.cfa(x,y)=p.sub.cfa(.sub.cfa(x,y))
p.sub.cfa(u)=0.5+0.5 cos(2u)
.sub.cfa(x,y)=((x,y)mod 2)/2
[0052] Where: m.sub.cfa(x,y) is the receiving information of the green filter layer on the camera image sensor at coordinates (x,y), p.sub.cfa() is the periodic function of the green filter layer in the CFA, and .sub.cfa (x,y) is in the CFA The phase function of the green filter layer. To calculate m.sub.enc(x,y)=p.sub.enc(.sub.enc(x,y)), we define p.sub.enc(u)=0.5+0.5 cos(2u). We perform phase modulation by mapping black and white in the two-dimensional code to different phases. Since m.sub.dec(x,y) and m.sub.cfa (x,y) are known, combined with the Moore theory and the Fourier transform theory:
m.sub.dec(x,y)=p.sub.dec(.sub.dec(x,y))=p.sub.dec(.sub.cfa(x,y).sub.enc(x,y))
.sub.enc(x,y)=.sub.cfa(x,y)p.sub.dec.sup.1(m.sub.dec(x,y))+2k, kZ
[0053]
[0054] QrCode encryption: using the CFA spatial frequency and modeling result of the scanning device, and the spatial frequency of the display device display, generating an encrypted image of the target two-dimensional code on the display device, specifically including:
[0055] Step A1: performing phase and frequency modulation on the original QrCode image picture by using the CFA spatial frequency of the scanning device and the modeling result, and the spatial frequency of the display device;
[0056] Step A2: Add Gaussian white noise to the modulated picture to blur the contour in the encrypted QrCode.
[0057] The use scene of the daily QrCode requires the QrCode to have a plurality of communication distances. In order to support a plurality of communication distances, the present invention expands the green filter layer space model function by modulating the frequency to generate a new space model.
[0058] QrCode decryption: The camera of the scanning device captures the encrypted QrCode in the display at a specified position and a specified angle, and restores the target QrCode and parses it, including:
[0059] Step B 1: acquiring a plurality of consecutive pictures captured by the camera in the specified position and the specified angle to encrypt the QrCode in the display;
[0060] Step B2: selecting an unprocessed image and convert the RGB image to the HSV coordinates to maximize the saturation dimension.
[0061] Step B3: determining, according to the positions of the three positioning marks, the size of the QrCode and dividing the QrCode for the converted picture to obtain a plurality of blocks;
[0062] Among them, there are two versions of common QR codes (version1 is 2121 squares and version2 is 177177 squares). The QR code has three positioning marks and is fixed in position, so we can distinguish the saturated image and determine the width and height, then calculate the size of each square and divide it, as shown in
[0063] Step B4: extracting a green square, for each pixel point, when the green intensity is greater than a predetermined threshold, it is judged to be white, and vice versa, it is judged to be black;
[0064] In order to reliably identify the squares with the same phase, we first separate the green squares from blue/red. For each pixel, when the green intensity is greater than the specified threshold, the pixel will be judged as white, otherwise it will be judged as black. The converted picture is shown in
[0065] Step B5: For each square, determine the color of the square according to the distribution of white and black pixel points in the square; wherein the noise added during the blurring of the QrCode contour and the noise generated during the shooting process which made in each square includes both black and white pixels. To classify each block into black or white, we use a weighted block filter to filter each block. The weight block filter is the same size as each small block in the QR code. The filter has more weight at the center of the block and a smaller weight at the edge of the block. After each block and the weight block filter are multiplied, the resulting weights are sorted into black and white according to a predetermined threshold.
[0066] Step B6: traversing all the black squares. Since the adjacent squares are all black, the adjacent two squares have the same modulation phase value, so all the adjacent black squares are marked to the same index value. The detailed methods are included:
[0067] Step B61: traversing all the black squares, and determining an index value of each block under the frame based on the principle that all adjacent black squares mark the same index value;
[0068] Step B62: determining whether the index value exists in each block, and if not, the index value of the block in the current frame is used as the index value of the block, otherwise, step B63 is performed:
[0069] Step B63: determining whether the index value of the block in the current frame is consistent with the previous index value. If not, all the blocks marked with the index value of the block in the previous frame are marked with the index value of the block under the frame.
[0070] Step B7: determining whether all the blocks are marked or unmarked squares are all surrounded by the marked blocks, if yes, proceed to step B8, otherwise, return to step B2;
[0071] Step B8: coloring according to the index value of each block. If two adjacent blocks have the same index value, they are colored into the same color, and vice versa, and then colored into different colors, the detail methods are shown in the following:
[0072] Step B81: coloring the squares in the three positioning mark areas;
[0073] Step B82, coloring according to the index values of the blocks based on the coloring result of the squares in the three positioning areas, if the two adjacent squares have the same index value, the colors are colored the same color, and vice versa. color the inverted.
[0074] The designated position is between 20 and 45 cm from the display. Preferably, the designated position is 30 cm from the display. In addition, the specified angle is perpendicular to the angle of the display plane.
[0075] We will use the Samsung S7 mobile phone to display the encrypted QR code, and then use the iPhone6 and HuaweiPLE to shoot and decrypt at the 30 cm and 0 position from the Samsung S7 mobile phone. As shown in
[0076] The present application provides a QrCode communication encryption method based on nonlinear spatial frequency characteristics, which uses a moir generated by an optical nonlinear spatial frequency to encrypt a target QrCode and is specified by a camera in a smartphone. The position and angle of the encrypted QR code are captured and decrypted to achieve secure communication of the two-dimensional code. Since the electronic screen displaying the QrCode itself has spatial frequency characteristics, the present application eliminates the need for special optical hardware and provides frequency modulation for a plurality of shooting distances. The present application systematically analyzes the spatial frequency characteristics of the screen and the camera, and realizes the encrypted communication of the QrCode on the common electronic display and the smart phone on the market.