A visual cryptography method with masked images
Through halftone technology and random grid idea, the grayscale masked image is quantized into binary images, and two secret images are encoded into three types of masked images, solving the problem of pixel-free expansion and ideal contrast in the prior art, and achieving complete restoration and secure sharing of the two secret images.
Patent Information
- Application Number
- CN202210789367.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-07-05
AI Technical Summary
The existing visual cryptographic technology with masked images is difficult to meet the conditions of pixel expansion and ideal contrast at the same time, and it is impossible to achieve complete restoration of two secret images without increasing the computational complexity.
Halftone technology is used to quantify the grayscale masking image into a binary masking image, and the basic idea of a random grid is used to encode two secret images into three types of meaningful masking images at the same time. The secret image can only be restored when decoding through XOR operation.
It realizes complete restoration of two secret images under pixel-free expansion conditions, improves the secret capacity, and maintains the visual quality of the masked image within a certain modification threshold, and has good security and anti-noise interference capabilities.
Smart Images

Figure CN115310103B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of information security, and in particular relates to a visual password method with a masked image. Background Art
[0002] The booming development of modern internet technology has brought tremendous convenience to people's lives. Information dissemination has become increasingly diverse, and the speed of information exchange has continued to accelerate. Text, images, and audio can all serve as carriers of information. However, this has also brought with it various issues concerning information security. Information transmission is inevitably subject to malicious attacks, information distortion, and image distortion. The leakage of personal privacy and confidential information during transmission can have irreversible and serious consequences. Therefore, ensuring the security and reliability of information during transmission has become a critical issue that requires consideration.
[0003] To address information security, researchers have proposed various solutions from various perspectives, including information hiding, cryptography, and network security. Cryptography, a prominent example, has significantly improved the security and reliability of information transmission. However, cryptography often requires additional space to store and manage keys. To address this key storage and management issue, Shamir and Barkly proposed secret sharing techniques in 1979, which do not require any keys. Secret sharing techniques distribute secret information to different participants, preventing it from being overly concentrated and thus reducing the risk of leaks. However, secret sharing techniques require extensive and complex computations. Visual Cryptography Scheme (VCS), a computationally inefficient secret sharing technique, has garnered widespread attention and application.
[0004] Visual cryptography schemes divide a secret image into several shared images and distribute them to different participants. Each participant receives a disorganized shared image. No participant can obtain any secret-related information from a single shared image, significantly reducing the risk of leaks. Once a user has access to a sufficient number of shared images, they can directly obtain the secret image through the human visual system (HVS) by overlaying transparencies printed with the shared images. This eliminates the need for cryptographic knowledge, significantly lowering the barrier to entry for users.
[0005] However, in existing visual cryptography technology solutions with cover images, it is difficult to simultaneously meet the two conditions of no pixel expansion and ideal contrast (completely recovering the secret image). Summary of the Invention
[0006] In order to solve the above problems, the present invention proposes a visual cryptography method with a cover image, which uses halftone technology and random grid ideas to achieve complete restoration of two secret images without pixel expansion and ideal contrast.
[0007] The technical solutions of the present invention are as follows:
[0008] A visual cryptography method with a cover image first uses a halftoning technique to create a meaningful grayscale cover image as a shared image. Then, two different secret images are simultaneously encoded into three types of meaningful cover images using the basic idea of a random grid, divided into qualified sets. Finally, during decoding, only when all the cover images in the specified qualified set are obtained can the corresponding secret image be completely restored through an exclusive-OR operation. The method specifically includes the following steps:
[0009] Step 1: Use halftoning technology to process the cover image; select n cover images H as carrier images for encoding the secret image, and quantize the grayscale cover image H into a binary cover image H' using halftoning technology;
[0010] Step 2: Encode the secret image using the basic idea of a random grid. Encode two different secret images simultaneously into three categories of meaningful cover images. Design corresponding qualified sets for the two images based on the three categories of cover images, with the size of each qualified set being k. During the secret pixel encoding process, obtain all k pixels of the cover images in the two qualified sets, compare the XOR results of the k pixels of the cover images in the two qualified sets with the corresponding secret pixels, and determine the category of the image to be modified based on the two comparison results. Randomly select a pixel of the cover image from this category for modification. Repeat the above steps until all secret pixels are encoded.
[0011] Step 3: Decode and restore the secret image. Only when the receiver obtains all the shared images in the qualified set can the corresponding secret image be completely restored through XOR operation.
[0012] Furthermore, in step 1, the error diffusion method of the halftone technique is used to process each pixel of the grayscale mask image H in a sequence from left to right and from top to bottom. The processing process is divided into two steps:
[0013] Step 1.1: Threshold the input value. Suppose the input value of the original mask image H at point (i, j) is x(i, j), the output value is y(i, j), and the quantization threshold is δ. The output value is calculated as shown in formula (1).
[0014]
[0015] Step 1.2: Diffuse the quantization error after thresholding; quantization error h(i,j) = x(i,j) - y(i,j). Since error diffusion is performed from left to right and from top to bottom, only x(i,j+1), x(i+1,j-1), x(i+1,j), and x(i+1,j+1) are not processed among the adjacent points of x(i,j). The quantization error h(i,j) of the current point is superimposed on the above four points with specific error diffusion parameters of 7 / 16, 3 / 16, 5 / 16, and 1 / 16. The error diffusion calculation method is shown in formula (2).
[0016]
[0017] Furthermore, the quantization threshold δ is set to 0.5, and the error diffusion method adopts the Jarvis filter.
[0018] Furthermore, in step 2, the specific encoding process is:
[0019] Step 2.1: Randomly divide all binary mask images into three uniform categories: SX, SY, and SZ, and divide the two secret images into different qualified sets; the qualified set of the first secret image is SX + SY; the qualified set of the second secret image is SY + SZ;
[0020] Step 2.2: Compare the pixel values of the first secret image with the XOR result of the pixels of all images in the qualified set SX+SY;
[0021] Step 2.3: Compare the pixel values of the second secret image with the pixel XOR results of all images in the qualified set SY+SZ;
[0022] Step 2.4: Based on the comparison results between the secret pixel and the mask image pixels in the corresponding qualified set, select the mask image in the corresponding category for modification to achieve the simultaneous sharing of the two secret pixels. The specific process is as follows: if the comparison results of the two secret images are different, select the pixels of any image in SY for inversion; if the comparison results of the first image are different and the comparison results of the second image are the same, select the pixels of a random image in SX for inversion; if the comparison results of the first image are the same and the comparison results of the second image are different, select the pixels of a random image in SZ for inversion; if the comparison results of the two secret images are the same, no pixels of any image need to be selected for inversion.
[0023] Step 2.5. Repeat steps 2.2-2.4 until all secret pixels are shared and the two secret images are encoded into all n shared cover images.
[0024] Furthermore, a modification threshold T of the cover image is set. For a secret image of size M×N, in order to ensure that each secret pixel is encoded, at most M×N pixels need to be modified in the cover image. The shared pixels to be modified are evenly distributed to n cover images, so that each cover image has the same probability of being modified, which conforms to the principle of randomness. The calculation of the modification threshold T is shown in formula (3):
[0025]
[0026] The minimum value of n is specified to be 4. When n=4, at most one secret image can be shared. When n>4, two secret images can be shared through n shared cover images.
[0027] Furthermore, the specific process of step 3 is as follows: after obtaining all the shared images in the qualified set, the shared images are superimposed and XORed to obtain the corresponding completely restored secret images; specifically, when the receiver obtains all the shared images in SX and SY, the first secret image is completely restored through the XOR operation; when the receiver obtains all the shared images in SY and SZ, the second secret image is completely restored through the XOR operation; in other cases, no secret image can be restored.
[0028] The beneficial technical effects brought about by the present invention are:
[0029] The present invention utilizes halftone technology and the basic idea of random grid to propose a visual cryptography scheme with a cover image, thereby realizing the simultaneous sharing of two secret images; based on the halftone technology of error expansion, the grayscale cover image is quantized into a binary cover image, which facilitates the encoding of the binary secret image; based on the basic idea of random grid, the XOR result of the cover image is regarded as a random value unrelated to the secret image, and by comparing the XOR result between the cover images with the secret pixels, the pixel value of a certain cover image is inverted within a certain modification threshold, thereby realizing the distribution of the secret pixels; the present invention has good security and realizes the complete restoration of the two secret images without pixel expansion. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A flowchart of a visual password method with a masked image according to the present invention;
[0031] Figure 2 A flowchart of encoding in a visual cryptographic method with a cover image according to the present invention;
[0032] Figure 3 This is a relationship diagram between the three types of shared images and the qualified set of secret images in the present invention. DETAILED DESCRIPTION
[0033] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:
[0034] In visual cryptography schemes with cover images, sharing a secret image using a meaningful cover image can reduce attacker suspicion and minimize the risk of secret leakage. This invention proposes a visual cryptography scheme with perfect contrast and no pixel expansion. Using halftoning technology, a meaningful grayscale cover image is used as the shared image. Then, utilizing the basic concept of a random grid, two different secret images are simultaneously encoded into three types of meaningful cover images, thereby reducing attacker suspicion. Halftoning quantizes the grayscale cover image into a binary image. By modifying the pixel values of a certain cover image, the XOR result of the pixels in the masked shared image within a qualified set is made consistent with the secret pixels. During decoding, only when all the cover images in the qualified set are obtained can the corresponding secret image be fully restored through the XOR operation. Experimental verification of this invention demonstrates that, within a modification threshold, modifying the values of a limited number of shared pixels does not affect the correct perception of the cover image by the human eye. Furthermore, this scheme maintains good performance even under salt and pepper noise interference. Furthermore, while conventional visual cryptography schemes with cover images can only share a single secret image through multiple cover images, the visual cryptography scheme proposed in this invention uses the cover image to simultaneously encode two secret images, thereby increasing the scheme's secret capacity.
[0035] First, let me introduce some professional terms.
[0036] 1. Secret Sharing Technology: Security and accuracy are paramount in the transmission of secret information. To ensure the secure transmission of secret information, Blakely and Shamir independently proposed a new concept in 1979: secret sharing. Secret sharing is a cryptographic technique that distributes and stores secret information. Its purpose is to prevent the secret from being too centralized and reduce the risk of leakage by distributing secret information. It is a key means of information protection and secret transmission. The principle of secret sharing is to split a secret into several parts, each called a share. Each share does not reveal any information about the secret. These shares are distributed and managed among different participants. This prevents individual participants from obtaining information about the secret. Only when a specific subset of users simultaneously provide their shares can the original secret be reconstructed. There are two types of secret sharing schemes: (k,n)-type secret sharing and (n,n)-type secret sharing. In (k,n)-type secret sharing, the secret is distributed as n shares, and the recipient only needs to obtain any k shares to obtain the secret information. In (n,n)-type secret sharing, all n participants must share the secrets in order to recover the secret information. Although secret sharing technology can ensure the security and reliability of secret information during transmission, it requires extensive mathematical calculations to distribute and synthesize secrets, requiring users to understand relevant cryptography knowledge, which greatly increases the user threshold. This is also the reason why secret sharing technology has not been widely used.
[0037] 2. Visual cryptography: Visual cryptography is a specialized secret sharing scheme. Unlike traditional secret sharing techniques, visual cryptography encrypts image information rather than character information. Furthermore, visual cryptography does not require any complex cryptographic calculations; it relies solely on the human eye to directly decipher the secret image. Visual cryptography utilizes lightweight computing devices to intuitively decode the secret image by simply overlaying qualified shared images. Visual cryptography distributes the secret image into n shared images, distributing the risk of secret leakage across these n shared images and thus enhancing the security of the transmission process. If the number of shared images received by the recipient does not reach a specified threshold, no information about the secret image can be obtained, further ensuring the reliability of image transmission.
[0038] 3. Visual Cryptography Scheme Performance Evaluation Metrics: Pixel expansion factor and contrast are commonly used as performance evaluation metrics in visual cryptography schemes. Regarding the pixel expansion factor, in typical visual cryptography schemes, a shared image is typically replaced with a block of pixels. Each block contains m pixels, meaning that a secret pixel is expanded into m shared pixels. This means that the size of each shared image is expanded to m times the size of the original secret image. This is the pixel expansion characteristic of visual cryptography, where m is the pixel expansion factor. To reduce storage and transfer costs, the shared image should be small, so the value of m should be as small as possible. Contrast: Contrast represents the brightness level between light and dark in the restored image, that is, the degree of brightness contrast within the image. A larger difference indicates a greater contrast, while a smaller difference indicates a less pronounced contrast. In visual cryptography schemes, a higher contrast is better, with the ideal contrast (maximum contrast) being 1.
[0039] 4. Halftoning: From a tonality perspective, images can be divided into two categories: continuous-tone images and halftone images. Continuous-tone images exhibit continuous variations in light and dark tones, with these variations determined by the density of color particles per unit area. Halftone images, on the other hand, exhibit variations in light and dark tones determined by the size and density of the dots. Halftoning involves quantizing continuous-tone images, such as grayscale and color images, into binary images or color images containing only a small number of colors using a small number of colors. The resulting quantized image maintains a certain visual similarity to the original image. Halftoning exploits the low-pass nature of human vision. When viewed from a distance, people typically perceive adjacent parts of an image as a single whole. By varying the size and density of dots, the perceived local average grayscale value approaches that of the original image, creating the overall effect of continuous tonal variation. Based on the processing method, halftoning techniques can be categorized into three types: dithering, error diffusion, and iterative methods. Both the dithering method and the iterative method have significant limitations. The error diffusion method uses the quantization mechanism of the dithering method to diffuse the quantization error to local adjacent points, thereby improving the quality of the output image. Therefore, the solution of the present invention adopts the error diffusion method to perform halftoning processing on the grayscale masked image.
[0040] A visual cryptography method with a cover image, first uses halftoning technology to use a meaningful grayscale cover image as a shared image, then divides the qualified set and uses the basic idea of random grid to simultaneously encode two different secret images into three types of meaningful cover images. Finally, during decoding, only when all the cover images in the qualified set are obtained can the corresponding secret image be completely restored through XOR operation. Figure 1 As shown, the specific steps include:
[0041] Step 1: Use halftoning to process the cover image. Select n cover images H as the carrier images for encoding the secret image. Use halftoning to quantize the grayscale cover image H into a binary cover image H'. The cover image can be randomly selected or set independently.
[0042] The error diffusion method using halftone technology processes each pixel of the grayscale mask image H in the order from left to right and from top to bottom. The processing process is mainly divided into two steps:
[0043] Step 1.1: Threshold the input value. Suppose the input value at point (i, j) in the original mask image H is x(i, j), the output value is y(i, j), and the quantization threshold is δ. A value of 0.5 is usually chosen as the quantization threshold. The output value is calculated as shown in Equation (1).
[0044]
[0045] Step 1.2: Diffuse the thresholded quantization error. The quantization error h(i,j) is the difference between the input value and the output value at that point, i.e., h(i,j) = x(i,j) - y(i,j). Since error diffusion is performed from left to right and from top to bottom, only x(i,j+1), x(i+1,j-1), x(i+1,j), and x(i+1,j+1) are not processed among the points adjacent to x(i,j). In the Floyd and Steinberg algorithm, the quantization error h(i,j) of the current point needs to be superimposed on the above four points using specific error diffusion parameters of 7 / 16, 3 / 16, 5 / 16, and 1 / 16 to ensure that the overall grayscale value in the area remains unchanged. The error diffusion calculation method is shown in Equation (2).
[0046]
[0047] The parameters of the quantization error can be represented by a matrix, also known as an error diffusion filter. Later, researchers improved the Floyd-Steinberg filter, such as the Jarvis filter, the Stucki filter, and the Shiau-Fan filter, which improved the output image quality and diffusion effect to varying degrees. However, complex filters often take a long time to calculate. Taking into account both output image quality and computational complexity, the Jarvis filter is used in the error diffusion algorithm of the present invention. Compared to the image output by the Floyd-Steinberg filter, the image obtained by the Jarvis filter is of higher quality. Halftone images processed by error diffusion have different and irregular pixel distributions, rich tones, and good visual effects.
[0048] Step 2: Encode the secret image using the basic concept of a random grid. Two different secret images are simultaneously encoded into three meaningful cover images. Based on the three cover image categories, corresponding qualified sets are designed for each image, each of size k. During the secret pixel encoding process, all k cover image pixels in the two qualified sets are obtained. The XOR results of these k cover image pixels in the two qualified sets are compared with the corresponding secret pixels. The two comparison results determine the category of the image to be modified. A pixel of the cover image is randomly selected from this category for modification. Repeat this step until all secret pixels have been encoded.
[0049] In the traditional (2,2)-VCS based on random grid, a shared image 1 is first randomly generated, and then the value of shared image 2 is determined based on the values of the secret image and shared image 1. In the present invention, since each pixel of the cover image may take a random value of 0 or 1 and has no correlation with the secret pixel, the pixels of these cover images are regarded as random pixels unrelated to the secret image, and the pixel XOR result of any k-1 cover images is also regarded as unrelated to the secret pixel. Using the basic idea of random grid, the present invention converts the random cover image H i '(1≤i≤k) is regarded as the shared image 2 to be modified, and the pixel XOR results of the remaining k-1 mask images are regarded as the random shared image 1, then H i ' will be determined by both the shared image 1 and the secret image. If the secret pixel is 0, then H i The pixel of ' is the same as the pixel of the other k-1 mask images. If the secret pixel is 1, then H i The pixel of ' is the opposite of the XOR result of the pixels of the other k-1 mask images.
[0050] The solution of the present invention adopts the basic idea of random grid and completes the encoding and decoding of the secret image by modifying some pixels of the cover image. No pixel expansion is introduced in this process. However, if too many pixels of the cover image are modified, the visual quality of the cover image itself will be seriously affected. In order to prevent the cover image from being excessively modified, a modification threshold T of the cover image is set. For a secret image of size M×N, in order to ensure that each secret pixel is encoded, a maximum of M×N pixels need to be modified in the cover image. The shared pixels to be modified are evenly distributed among the n cover images, so that each cover image has the same probability of being modified, which conforms to the principle of randomness. The calculation of the modification threshold T is shown in formula (3).
[0051]
[0052] The modification threshold depends on the total number of mask images, n. When n is small, the mask image modification ratio is too large, and the visual quality is reduced. When there are two mask images involved in the sharing (n is 2), half of the pixels in each mask image will be modified, seriously affecting the correct recognition of the mask image itself. When n is 3, one-third of the pixels in each mask image will be modified, and the visual quality is still poor. When n is greater than or equal to 4, that is, when there are more than or equal to 4 shared mask images, the impact of the secret image on the mask image is relatively small. The larger n is and the smaller T is, the smaller the maximum number of pixels that can be modified in each mask image, and the higher the visual quality of the mask image itself. Therefore, in the present invention, the minimum value of n is set to 4. When n = 4, at most one secret image can be shared. When n > 4, two secret images can be shared through n shared mask images. Therefore, the present invention is applicable to cases where n > 4.
[0053] like Figure 2 As shown, the specific encoding process is:
[0054] Step 2.1: Randomly divide all binary mask images into three uniform categories: SX, SY, and SZ, and divide the two secret images into different qualified sets; Figure 3 As shown, the qualified set of the first secret image is SX+SY; the qualified set of the second secret image is SY+SZ;
[0055] Step 2.2: Compare the pixel values of the first secret image with the XOR result of the pixels of all images in the qualified set SX+SY;
[0056] Step 2.3: Compare the pixel values of the second secret image with the pixel XOR results of all images in the qualified set SY+SZ;
[0057] Step 2.4: Based on the comparison results between the secret pixel and the corresponding mask image pixel in the qualified set, select the mask image within the corresponding category for modification, completing the sharing of the two secret pixels simultaneously. The specific process is as follows: If the comparison results of the two secret images are different, select a pixel in any image in SY and invert it (0 to 1, 1 to 0); if the comparison results of the first image are different and the comparison results of the second image are the same, select a pixel in a random image in SX and invert it; if the comparison results of the first image are the same and the comparison results of the second image are different, select a pixel in a random image in SZ and invert it; if the comparison results of the two secret images are the same, no pixel in any image needs to be inverted.
[0058] Step 2.5. Repeat steps 2.2-2.4 until all secret pixels are shared and the two secret images are encoded into all n shared cover images.
[0059] This encoding process does not perform pixel expansion, and two secret images can be shared under the same storage space.
[0060] Step 3: Decode and restore the secret image. Only when the receiver obtains all the shared images within the qualified set can the corresponding completely restored secret image be obtained through XOR operation. The specific process is as follows: After obtaining all the shared images within the qualified set, perform superposition XOR operation on the shared images to obtain the corresponding completely restored secret image. For example, when the receiver obtains all the shared images in SX and SY, the first secret image can be completely restored through XOR operation; when the receiver obtains all the shared images in SY and SZ, the second secret image can be completely restored through XOR operation. In other cases, no secret image can be restored.
[0061] To prove the feasibility and superiority of the present invention, theoretical analysis and simulation experiment analysis are carried out.
[0062] I. Theoretical analysis:
[0063] (1) Security analysis
[0064] First, it is assumed that the masking image in SX will share and encode the first secret image with the masking image in SY, that is The masking image in SY will share and encode the second secret image with the masking image in SZ, that is Because the pixels of each shared masking image have no direct connection with the pixels of the secret image, a single shared image cannot disclose any information related to the secret image. When k'(1≤k'<k) shared images are obtained, the XOR operation result is random 0 / 1 and no secret image can be restored. When XOR operation is performed on any k shared images outside the qualified set, the result is a random value 0 / 1 and no secret image can be restored either. Only when all k shared images within the qualified set are XORed, can secret image 1 be completely restored; similarly, only when the k shared images within the qualified set are XORed, can secret image 2 be restored. Therefore, only the shared images within the qualified set can restore the image, which proves the security of this scheme.
[0065] [[ID=
[0067]
[0068] Where M×N is the size of image I.
[0069] In the visual cryptography scheme, let the original secret image be I and the restored image be I′. The calculation method of contrast ω is given below:
[0070]
[0071] Here, I'[I(0)] represents the area in the restored image I' corresponding to all white pixels in the original secret image I, and I'[I(1)] represents the area in the restored image I' corresponding to all black pixels in the original image I. The larger l(I'1[I1(0)]), the larger the ω value; the smaller l(I'1[I1(1)]), the larger the ω value. When constructing a visual cryptography scheme, a larger ω value indicates a more pronounced black-white contrast and better contrast performance. The maximum value of ω is 1.
[0072] In the specific contrast calculation of this theoretical analysis, in the restored image I′1, all white pixels of the original secret image I1 are restored to white, l(I′1[I1(0)])=1; all black pixels are restored to black, l(I′1[I1(1)])=0. Substituting the above results into equation (5), we can calculate the contrast of I′1 as ω1=1. Similarly, in the restored image I′2, all white pixels of the secret image I2 are restored to white, l(I′2[I2(0)])=1; all black pixels are restored to black, l(I′2[I2(1)])=0. Substituting the results into equation (5), we can calculate the contrast of I′2 as ω2=1.
[0073] Therefore, in the visual cryptography scheme with a cover image, the restored image has an ideal contrast, achieving complete restoration of the secret image.
[0074] 2. Simulation Experiment Analysis:
[0075] Experiment 1: Simulation experiment on a single secret image
[0076] An experimental verification using the (4,4)-VCS scheme is performed as an example. The secret image is I, and the four meaningful grayscale mask images are H1, H2, H3, and H4. The binary mask images after halftoning the grayscale mask images are H′1, H′2, H′3, and H′4. The binary secret image I is encoded into the modified pixels of some mask images, resulting in the final shared mask images S1, S2, S3, and S4. Although the quality of each shared mask image is degraded, it does not affect human perception, and a single shared mask image does not reveal any secret-related information. Decoding without all four shared images is impossible to fully recover the secret image. Specifically, the XOR operation of S1 and S2 cannot recover the secret image, nor can the image recovered by XORing S1, S2, and S3. Only when the receiver obtains all four shared images, S1, S2, S3, and S4, can the secret image be fully recovered through XORing.
[0077] In Experiment 1, the size of both the secret image and the cover image was 512×512, the number of shared images was 4, and the calculated threshold value T = 65536. Table 1 lists the number of 0 / 1 pixels, the number of modified pixels, and the percentage of modified pixels before and after encoding for each shared cover image. Pixel modifications include changing 0 to 1 and changing 1 to 0. The number of modified pixels is the sum of the two, while the difference in the number of 0s (or 1s) before and after encoding is the absolute value of the difference. Therefore, the difference in the number of 0s (or 1s) before and after encoding in the shared cover image is less than the number of modified pixels. The maximum number of modified pixels in the shared cover image before and after encoding is 32952, accounting for 12.57% of the total number of pixels, which is less than the threshold value of 65536. This proves that the solution of the present invention is feasible for a single secret image.
[0078] Table 1 Number and proportion of pixels modified before and after encoding of shared images
[0079]
[0080] Experiment 2: Salt and pepper noise resistance experiment
[0081] In addition, the solution of the present invention can also resist image spatial noise such as salt and pepper noise, ensuring that even if the image is partially interfered with by noise during transmission, it will not affect the decoding of the secret image. Although the quality of the restored image under noise attack is reduced, it still does not affect the correct recognition of the restored image by the human eye perception system.
[0082] In the experiment, salt and pepper noise was applied to the shared mask images S1, S2, S3, and S4. The processed images were S1', S2', S3', and S4'. The XOR operation result of the shared images after salt and pepper noise processing was I'. Compared with the original secret image I, only a few pixels in the restored image I' were affected by the salt and pepper noise, which did not affect the human eye's correct perception of the secret image information.
[0083] Experiment 3: Simulation experiment on two secret images
[0084] In order to prove the feasibility of the proposed scheme for two secret images, the (4,4,6)-VCS example is used for verification, and the qualified set is set to And SX={S1,S2}, SY={S3,S4}, SZ={S5,S6}. The two secret images are I1 and I2, and the 6 grayscale mask images are H1, H2, H3, H4, H5, H6. The shared mask images after halftoning and encoding the secret image are S1, S2, S3, S4, S5, S6. A single mask image does not reveal any secret image. The experimental results show that any shared image that is not in the qualified set cannot restore the secret image by XOR decoding. Specifically, the shared images S1 and S2 are XORed, and S1, S3 and S5 are XORed, and no secret image is restored. Only when all the shared images in the qualified set are XORed, can the corresponding secret image be completely restored. Specifically, when the qualified set When the shared images S1, S2, S3 and S4 in the set are XORed, the secret image I1 can be successfully recovered. When the four shared images S3, S4, S5 and S6 are XORed, the secret image I2 is completely restored.
[0085] In Experiment 3, the size of both the secret and cover images was 512×512, with a total of 262,144 pixels. Table 2 lists the number of 0s / 1s, the number of modified pixels, and the percentage of modified pixels before and after encoding for each shared cover image. The number of modified pixels before and after encoding for each shared cover image ranged from 31,000 to 34,000, accounting for 12% to 13% of the total number of pixels. The distribution of modified pixels is uniform, demonstrating the effectiveness of the classification principle of this scheme.
[0086] Table 2 Number and proportion of pixels modified before and after encoding of shared images
[0087]
[0088] The above theoretical analysis and simulation experiments prove that the visual cryptography scheme proposed in the present invention does not perform pixel expansion and can achieve complete restoration of the secret image, thus having good security and feasibility.
[0089] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the scope of protection of the present invention.
Claims
1. A visual password method with a masked image, characterized in that First, a meaningful grayscale mask image is used as a shared image through halftoning technology. Then, two different secret images are simultaneously encoded into three types of meaningful mask images using the basic idea of random grids, which is divided into qualified sets. Finally, during decoding, only when all mask images in the specified qualified set are obtained can the corresponding secret image be completely restored through XOR operation. The specific steps include the following: Step 1: Use halftoning technology to process the cover image; select n cover images H as carrier images for encoding the secret image, and quantize the grayscale cover image H into a binary cover image H' using halftoning technology; Step 2: Encode the secret image using the basic idea of a random grid. Encode two different secret images simultaneously into three categories of meaningful cover images. Design corresponding qualified sets for the two images based on the three categories of cover images, with the size of each qualified set being k. During the secret pixel encoding process, obtain all k pixels of the cover images in the two qualified sets, compare the XOR results of the k pixels of the cover images in the two qualified sets with the corresponding secret pixels, and determine the category of the image to be modified based on the two comparison results. Randomly select a pixel of the cover image from this category for modification. Repeat the above steps until all secret pixels are encoded. The specific encoding process is: Step 2.1: Randomly divide all binary mask images into three uniform categories: SX, SY, and SZ, and divide the two secret images into different qualified sets; the qualified set of the first secret image is SX + SY; the qualified set of the second secret image is SY + SZ; Step 2.2: Compare the pixel values of the first secret image with the XOR result of the pixels of all images in the qualified set SX+SY; Step 2.3: Compare the pixel values of the second secret image with the pixel XOR results of all images in the qualified set SY+SZ; Step 2.4: Based on the comparison results between the secret pixel and the mask image pixels in the corresponding qualified set, select the mask image in the corresponding category for modification to achieve the simultaneous sharing of the two secret pixels. The specific process is as follows: if the comparison results of the two secret images are different, select the pixels of any image in SY for inversion; if the comparison results of the first image are different and the comparison results of the second image are the same, select the pixels of a random image in SX for inversion; if the comparison results of the first image are the same and the comparison results of the second image are different, select the pixels of a random image in SZ for inversion; if the comparison results of the two secret images are the same, no pixels of any image need to be selected for inversion. Step 2.5: Repeat steps 2.2-2.4 until all secret pixels are shared and the two secret images are encoded into all n shared cover images. Step 3: Decode and restore the secret image. Only when the receiver obtains all the shared images in the qualified set can the corresponding secret image be completely restored through XOR operation.
2. The visual password method with a masked image according to claim 1, characterized in that: In step 1, the error diffusion method of the halftone technique is used to process each pixel of the grayscale mask image H in a sequence from left to right and from top to bottom. The processing process is divided into two steps: Step 1.1: Threshold the input value. Suppose the input value of the original mask image H at point (i, j) is x(i, j), the output value is y(i, j), and the quantization threshold is δ. The output value is calculated as shown in formula (1). Step 1.2: Diffuse the quantization error after thresholding; quantization error h(i,j) = x(i,j) - y(i,j). Since error diffusion is performed from left to right and from top to bottom, only x(i,j+1), x(i+1,j-1), x(i+1,j), and x(i+1,j+1) are not processed among the adjacent points of x(i,j). The quantization error h(i,j) of the current point is superimposed on the above four points with specific error diffusion parameters of 7 / 16, 3 / 16, 5 / 16, and 1 / 16. The error diffusion calculation method is shown in formula (2).
3. The visual password method with a masked image according to claim 2, characterized in that: The quantization threshold δ is set to 0.5, and the error diffusion method uses the Jarvis filter.
4. The visual password method with a masked image according to claim 1, characterized in that: Set the modification threshold T of the cover image. For a secret image of size M×N, in order to ensure that every secret pixel is encoded, at most M×N pixels need to be modified in the cover image. The shared pixels to be modified are evenly distributed to n cover images, so that each cover image has the same probability of being modified, which conforms to the principle of randomness. The calculation of the modification threshold T is shown in formula (3): The minimum value of n is specified to be 4. When n=4, at most one secret image can be shared. When n>4, two secret images can be shared through n cover images.
5. The visual password method with a masked image according to claim 1, characterized in that: The specific process of step 3 is as follows: after obtaining all shared images in the qualified set, performing a superimposed XOR operation on the shared images to obtain the corresponding completely restored secret image; specifically, when the receiver obtains all shared images in SX and SY, the first secret image is completely restored through the XOR operation; when the receiver obtains all shared images in SY and SZ, the second secret image is completely restored through the XOR operation; in other cases, no secret image can be restored.
Citation Information
Patent Citations
Extension visual encryption and decryption method
CN104574262A
Secret sharing method and system based on visual effect
CN112422767A