Color image hiding and multi-color dynamic display method based on special form grating
By constructing a periodic grating base and embedding color image components, and combining the water ripple dynamic diffusion algorithm to adjust the grating offset, the problems of the traditional Moiré grating's single display effect and poor stability are solved, and the high confidentiality and diversified dynamic display of color images are achieved.
Patent Information
- Application Number
- CN202510618032.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-09-09
AI Technical Summary
Traditional moiré grating technology has a single display effect, is difficult to achieve multi-tone and real-time interaction, and has poor stability.
By using a special morphological grating, constructing a periodic grating base, embedding the color image component and superimposing the key grating, and combining the water ripple dynamic diffusion algorithm to adjust the grating offset, the color image can be hidden and multi-color dynamic display can be achieved.
It achieves high confidentiality and diversified dynamic display of color images, overcomes the shortcomings of traditional moiré gratings, and provides rich display effects and good dynamic performance.
Smart Images

Figure CN120612394A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to image information hiding and optical anti-counterfeiting technology, in particular to a color image hiding and multi-color dynamic display method based on a special morphology grating. Background Art
[0002] Moiré grating technology is an information hiding and display method based on the principle of optical interference. Its core is to use the moiré fringe effect produced by the superposition of two or more layers of gratings to achieve image hiding and display. The formation of moiré fringes is due to the change in light intensity distribution caused by the relative displacement or angle change between the gratings. This phenomenon is widely used in fields such as precision measurement, information hiding and display technology.
[0003] In traditional moiré grating technology, linear moiré grating is the most common form. It produces stripes by superimposing two layers of linear gratings to achieve image hiding and decoding. However, linear moiré grating has the following limitations: First, its display effect is relatively simple, usually only able to achieve simple black and white or single-tone display, and it is difficult to meet the multi-tone requirements of complex images; second, linear moiré grating has difficulty in achieving real-time interaction and dynamic effects; third, the hiding effect of linear moiré grating is easily affected by changes in angle and displacement, and has poor stability.
[0004] In order to solve the above-mentioned deficiencies, it is urgent to provide a special morphological grating to achieve image hiding and dynamic display. Summary of the Invention
[0005] The present invention aims to provide a color image hiding and multi-color dynamic display method based on special morphological grating, which realizes high confidentiality and diversified dynamic display of target images with different tones.
[0006] The present invention is achieved through the following technical solutions:
[0007] A method for hiding a color image and dynamically displaying multiple colors based on a special morphological grating comprises the following steps:
[0008] Step 1: Construct a grating basis in the image processing and compilation software to generate a periodic grating, which is expressed as:
[0009]
[0010] Where α and β are the background intensity and contrast of the grating fringe pattern, respectively, (i, j) is the image pixel coordinate, is the periodic function that determines the grating shape, expressed as:
[0011]
[0012] Where k is the scaling factor used to control the radial frequency of the grating fringe spacing, and d is the parameter that determines the grating morphology;
[0013] Step 2: First extract the R, G, and B components J in the target color image z (i,j), expressed as:
[0014] J z (i,j)=(:.:.X),z∈{r,g,b}
[0015] Where, the values of X are 0, 1, and 2 respectively; r, g, and b represent R, G, and B channels respectively;
[0016] Normalize the pixel values of the R, G, and B components to the range of [0, 1], and then embed the R, G, and B components into the phase parameters of the periodic grating. The grating ID generated by the three channels of R, G, and B is Z (i,j) is expressed as:
[0017] ID Z (i,j)=IR(i,j)+J z ′(i,j)
[0018] Where, J z ′(i,j) is the grayscale encoding matrix of the three channels R, G, and B of the hidden image;
[0019] Step 3: Superimpose the gratings generated by the three channels R, G, and B to obtain the grating ID (i, j) containing the target color image, which is expressed as:
[0020]
[0021] Where ID(i,j) represents the sum of the gratings generated by the three channels R, G, and B;
[0022] Step 4: Construct a key grating IK(i, j) with the same period and shape as the periodic grating, and superimpose it with ID(i, j) to obtain the grating IG(i, J) used to display the target color image information, which is expressed as:
[0023] IG(i,j)=ID(i,j)×IK(i,j)
[0024] Where, the generation formula of the key grating IK(i,j) is the same as that of IR(i,j);
[0025] Step 5: Adjust the radial phase offset of the grating IG(i, j) through the water ripple dynamic diffusion algorithm, control the diffusion speed and amplitude of the grating ripples, and dynamically change the shape of the key grating IK(i, j), thereby dynamically displaying the target color image;
[0026] Step 6: Output the key raster, the raster containing the target color image, and the target images of different colors revealed at different time periods.
[0027] Furthermore, the output format of the annular grating substrate in step 1 is JPG, PNG or TIFF, with a resolution of 300-1200 dpi.
[0028] Furthermore, the period of the periodic grating in step 1 is (0-1).
[0029] Furthermore, the parameter d that determines the grating morphology in step 1 is expressed as:
[0030]
[0031] x=(Xa)
[0032] y=(Yb)
[0033] Where (Y, X) is the pixel coordinate and (a, b) is the center point of the circular grating.
[0034] Furthermore, the target color image in step 2 is in JPG, PNG or TIFF format.
[0035] Furthermore, the process of normalizing the pixel values of the R, G, and B components in step 2 is expressed as follows:
[0036]
[0037] Where, I z is the grayscale encoding matrix of the three channels of pixel values R, G, and B, m,z∈{r,g,b}, (x,y) is the pixel coordinate position.
[0038] Furthermore, the raster ID (i, j) in step 3 is expressed in Python as:
[0039] ID(i,j)=cv2.merge([ID b (i,j),ID g (i,j),ID r (i,j)]).
[0040] Furthermore, the process of dynamically changing the shape of the key grating IK(i,j) in step 5 is expressed as:
[0041] IK'(i,j)=IK(i,j)+Δr(t)
[0042] Where Δr(t) is the water ripple dynamic diffusion algorithm, which is expressed as:
[0043] Δr(t)=Asin(φ(t))
[0044] Where A is the amplitude and φ(t) is the phase shift function. By adjusting A and φ(t), the diffusion speed and dynamic changes of the amplitude of the grating ripples can be controlled.
[0045] Furthermore, the phase shift function φ(t) is expressed as:
[0046]
[0047] ω=θf
[0048] Where ω represents the angular frequency, θ is the function period parameter, θ=kπ, k∈Z, f is the frequency, is the phase offset parameter, and t is the time.
[0049] Furthermore, the target color image dynamically displayed in step 5 includes 1 to 16 colors in total, and the colors are layered through the HSV color space, and each layer corresponds to the offset of the grating phase.
[0050] The present invention has the following beneficial technical effects:
[0051] 1) The present invention uses a periodic function to generate a special morphology grating base through image compilation and processing software. After the target color image is separated by channels and normalized to grayscale, a color image is hidden in a circular moiré grating through a periodic profile function to achieve image hiding. By superimposing a key grating with the same period and morphology as the grating base, information similar to the target image can be displayed. Then, the offset of the grating is modulated through a water ripple dynamic diffusion algorithm to dynamically display image information of 1 to 16 different colors, achieving high concealment and diverse dynamic display effects. This is because the special morphology of the grating utilizes its unique geometric structure to make the formation of moiré fringes more flexible, and can maintain a stable display effect at different angles and displacements, providing richer display effects and better dynamic performance. In addition, by adjusting the grating offset, multi-tone display can be achieved, which improves the diversity and practicality of image hiding and display. It is suitable for fields such as image hiding, anti-counterfeiting labels, and dynamic art design.
[0052] 2) The image hiding and dynamic display method based on a special grating shape provided by the present invention inherits the advantages of the moiré grating technology and overcomes the shortcomings of the linear moiré grating by optimizing the ring structure, thus providing a new development direction for information hiding and display technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 : The key grating for decryption obtained in Application Example 1 of the present invention;
[0054] Figure 2 : The circular grating containing the target color image obtained in Application Example 1 of the present invention;
[0055] Figure 3 : Application Example 2 of the present invention discloses a color scale image of a target color image in the first second;
[0056] Figure 4 : Application Example 2 of the present invention discloses the color scale image of the target color image in the 8th second. DETAILED DESCRIPTION
[0057] The present invention will be further described in detail below with reference to specific embodiments, which are intended to explain the present invention rather than to limit it.
[0058] A method for hiding a color image and dynamically displaying multiple colors based on a special morphological grating comprises the following steps:
[0059] Step 1: Construct a circular grating base in the image processing and compilation software to generate a periodic grating, which is expressed as:
[0060]
[0061] Where: α and β are the background intensity and contrast of the grating fringe pattern, respectively, which are the two main parameters that determine the grating period and morphology; (i, j) is the image pixel coordinate, is the periodic function that determines the grating shape, expressed as:
[0062]
[0063] Where k is the scaling factor, which controls the radial frequency of the grating fringe spacing from (0 to π) to make the grating fringe spacing uniformly distributed. d is the parameter that determines the grating morphology and is expressed as:
[0064]
[0065] Where (Y, X) is the image pixel coordinate, (a, b) is the center point of the ring grating, and the required grating image is obtained by processing the pixels. The period of the ring grating is (0 to 1);
[0066] The output format of the circular grating substrate is JPG, PNG or TIFF, with a resolution of 300-1200dpi, suitable for printing or digital media;
[0067] Step 2: Process the target color image. In this embodiment, the RGB color mode is used as an example. The target color image is in JPG, PNG, or TIFF format with a resolution of 300 to 2540 dpi.
[0068] Taking Python as an example, using J z The (i,j)=(:.:.X),z∈{r,g,b} function extracts the R, G, and B components of the target image, where X is 0, 1, and 2, and r, g, and b represent the R, G, and B channels, respectively.
[0069] Next, the pixel values of the R, G, and B components are normalized to the range of [0, 1]. The specific operation of the pixel value normalization is:
[0070]
[0071] Then, the R, G, and B components are embedded in the phase parameters of the periodic grating, and the grating ID generated by the three channels of R, G, and B is Z (i,j) is expressed as:
[0072] ID Z (i,j)=IR(i,j)+J z ′(i,j)
[0073] Where, j z ′(i,j) is the grayscale encoding matrix of the three channels R, G, and B of the hidden image;
[0074] Step 3: Superimpose the gratings generated by the three channels R, G, and B to obtain the grating ID (i, j) containing the target color image, which is expressed as:
[0075]
[0076] Where ID(i,j) represents the sum of the gratings generated by the three channels R, G, and B;
[0077] Taking Python as an example, the specific process of step 3 is expressed as follows:
[0078] ID(i,j)=cv2.merge([ID b (i,j),ID g (i,j),ID r (i,j)])
[0079] The grating containing the target color image is in JPG, PNG or TIFF format, with a resolution of 300 to 2540 dpi, and the size of the grating is 50% to 100% of the size of the target color image;
[0080] Step 4: Construct a key grating IK(i, j) with the same period and shape as the periodic grating, and superimpose it with ID(i, j) to obtain the grating IG(i, j) used to display the target color image information, which is expressed as:
[0081] IG(i,j)=ID(i,j)×IK(i,j)
[0082] The generation formula of the key raster IK(i,j) is the same as that of IR(i,j), and the required parameters are also the same. The key raster is in JPG, PNG or TIFF format, and the raster size is 50% to 100% of the target image size.
[0083] Step 5: Adjust the radial phase offset of the grating IG(i, j) by using the water ripple dynamic diffusion algorithm to control the diffusion speed and amplitude of the grating ripples, dynamically change the shape of the key grating IK(i, j), and obtain a superimposed grating image for dynamically displaying target images of different colors;
[0084] The superimposed raster image is in JPG, PNG or TIFF format with a resolution of 300 to 2540 dpi;
[0085] The water ripple dynamic diffusion algorithm supports real-time interactive functions. According to different offset adjustments, the shape of the key grating is changed. By superimposing key gratings of different shapes, target images of different colors can be displayed. The process of dynamically changing the shape of the key grating IK(i,j) is as follows:
[0086] IK'(i,j)=IK(i,j)+Δr(t)
[0087] Where Δr(t) is the water ripple dynamic diffusion algorithm, and its implementation method takes the sin function as an example and is expressed as:
[0088] Δr(t)=Asin(φ(t))
[0089] Where A is the amplitude and φ(t) is the phase shift function. By adjusting A and φ(t), the diffusion speed and amplitude of the grating ripples can be controlled.
[0090] The phase shift function φ(t) is expressed as:
[0091]
[0092] ω=θf
[0093] Where ω represents the angular frequency, θ is the function period parameter, θ=kπ, k∈Z, f is the frequency, f is the frequency, is the parameter of phase offset, t is time;
[0094] The image processing and compilation software dynamically superimposes moiré fringes, which can display a target image with 1 to 16 different colors. The displayed target image colors are layered in the HSV color space, with each layer corresponding to the offset of the grating phase. The superimposed grating image is in JPG, PNG or TIFF format with a resolution of 300 to 2540 dpi.
[0095] Step 6: Output the key raster, the raster containing the target color image, and the target images of different colors revealed at different time periods.
[0096] Preferably, the grating substrate may be a non-linear grating other than a circular ring.
[0097] Preferably, the periodic function may be other curve functions besides the cosine function, and different forms of periodic gratings, such as square waves or triangle waves, may be generated by using different curve functions.
[0098] Preferably, the target color image may be in other color space modes besides the RGB color mode.
[0099] Application Example 1
[0100] A colored pencil image with a size of 1000 pixels × 1000 pixels, a resolution of 1100 dpi and a JPG format is used as the target color image (also called a hidden image) for hiding and dynamic display;
[0101] Step 1: Construct a circular grating basis in the image processing and compilation software. The values of α and β are 0.5, the scale factor k is π / 4, and the center point coordinates of the circular grating are (500, 500);
[0102] Step 2: Format the target color image RGB. Take Python as an example and use J z The (i, j) = (:.:.X), z∈{r,g,b} function extracts the R, G, and B components of the target color image, where the values of z are 1, 2, and 3, respectively. The pixel values of the R, G, and B components are normalized, and then the grayscale coding matrices of the R, G, and B channels are embedded in the phase parameters of the grating respectively.
[0103] Step 3: Superimpose the gratings generated by the three channels R, G, and B to obtain the grating I containing the hidden image. ori , the output format is TIFF, the resolution is 1100dpi;
[0104] Step 4: Construct a grating with the same period and shape as the grating base. Figure 1 The key grating I shown key and compare it with I ori Superposition is performed to obtain Figure 2 The information shown is similar to the target color image. The generation formula of the key grating is the same as that of IR(i,j), and the parameters required for the two are also the same. The output format of the grating base is TIFF, the resolution is 1100dpi, and the grating size is 100% of the target image size.
[0105] Step 5: Adjust the radial phase offset Δr of the grating by using the water ripple dynamic diffusion algorithm, select the amplitude as 20, the diffusion frequency as 0.5, the initial phase as 0, control the diffusion speed and direction of the grating ripple, dynamically display the hidden image of different tones, and key Dynamic adjustment;
[0106] Step 6: Output the key grating, the grating containing the hidden image, and the target color image of different colors revealed at different time periods.
[0107] By comparison Figure 1 and Figure 2 It can be seen that through image processing and compilation software, I key Dynamically superimposed on I ori Above, the target color image with 8 hidden colors is displayed. Each layer of image requires a preset offset to be displayed correctly. The output format of the target image is TIFF, and the resolution is 1100dpi.
[0108] Application Example 2
[0109] A watermelon image with a size of 1000 pixels × 1000 pixels, a resolution of 720 dpi, and a JPG format is used as the target color image for hiding and dynamic display:
[0110] Step 1: Construct a circular grating basis in the image processing and compilation software. The values of α and β are 0.5, the scale factor k is π / 4, and the center point coordinates of the circular grating are (500, 500);
[0111] Step 2: Format the target color image RGB. Take Python as an example and use J z The (i, j) = (:.:.X), z∈{r,g,b} function extracts the R, G, and B components of the target color image, where the values of z are 1, 2, and 3, respectively. The pixel values of the R, G, and B components are normalized, and then the grayscale coding matrices of the R, G, and B channels are embedded in the phase parameters of the grating respectively.
[0112] Step 3: Superimpose the gratings generated by the three channels R, G, and B to obtain the grating I containing the hidden image. ori , the output format is TIFF, the resolution is 720dpi;
[0113] Step 4: Construct a key grating I with the same period and shape as the grating base key and compare it with I ori The key grating is generated by superimposing the image and displaying a circular grating that is similar to the target color image information. The generation formula of the key grating is the same as that of IR(i,j), and the parameters required for both are also the same. The output format of the grating base is TIFF, the resolution is 1100dpi, and the grating size is 100% of the target image size.
[0114] Step 5: Adjust the radial phase offset Δr of the grating by using the water ripple dynamic diffusion algorithm, select the amplitude as 20, the diffusion frequency as 0.5, the initial phase as 0, control the diffusion speed and direction of the grating ripple, dynamically display the hidden image of different tones, and key Dynamic adjustment of
[0115] Through image processing and compilation software, I key Dynamically superimposed on I ori Above, the target color image with 8 hidden colors is displayed. Each layer of image requires a specific offset to be displayed correctly. The output format of the target image is TIFF with a resolution of 720dpi.
[0116] Step 6: Output the key raster, the raster containing the hidden image, and the Figure 3 and Figure 4 The target images of different colors are revealed at different time periods as shown.
[0117] By comparison Figure 3 and Figure 4 ,It can be seen that the color of the target image revealed changes in different time periods.
Claims
1. A method for color image hiding and multi-color dynamic display based on special morphological grating, characterized in that: The following steps are involved: Step 1: Construct a grating basis in the image processing and compilation software to generate a periodic grating, which is expressed as: Where α and β are the background intensity and contrast of the grating fringe pattern, respectively, (i, j) is the image pixel coordinate, is the periodic function that determines the grating shape, expressed as: Where k is the scaling factor used to control the radial frequency of the grating fringe spacing, and d is the parameter that determines the grating morphology; Step 2: First extract the R, G, and B components J in the target color image z (i,j), expressed as: j z (i,j)=(:.:.x),z∈{r,g,b} Where, the values of X are 0, 1, and 2 respectively; r, g, and b represent R, G, and B channels respectively; Normalize the pixel values of the R, G, and B components to the range of [0, 1], and then embed the R, G, and B components into the phase parameters of the periodic grating. The grating ID generated by the three channels of R, G, and B is Z (i,j) is expressed as: ID Z (i,j)=IR(i,j)+J z ′(i,j) Where, J z ′ (i, j) is the grayscale encoding matrix of the three channels R, G, and B of the hidden image; Step 3: Superimpose the gratings generated by the three channels R, G, and B to obtain the grating ID (i, j) containing the target color image, which is expressed as: Where ID(i,j) represents the sum of the gratings generated by the three channels R, G, and B; Step 4: Construct a key grating IK(i, j) with the same period and shape as the periodic grating, and superimpose it with ID(i, j) to obtain the grating IG(i, j) used to display the target color image information, which is expressed as: IG(i,j)=ID(i,j)×IK(i,j) Where, the generation formula of the key grating IK(i,j) is the same as that of IR(i,j); Step 5: Adjust the radial phase offset of the grating IG(i, j) through the water ripple dynamic diffusion algorithm, control the diffusion speed and amplitude of the grating ripples, and dynamically change the shape of the key grating IK(i, j), thereby dynamically displaying the target color image; Step 6: Output the key raster, the raster containing the target color image, and the target images of different colors revealed at different time periods.
2. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The output format of the annular grating substrate in step 1 is JPG, PNG or TIFF, with a resolution of 300-1200 dpi.
3. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The period of the periodic grating in step 1 is (0-1).
4. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The parameter d that determines the grating shape in step 1 is expressed as: x=(Xa) y=(Yb) Where (Y, X) is the pixel coordinate and (a, b) is the center point of the circular grating.
5. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The target color image in step 2 is in JPG, PNG or TIFF format.
6. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The process of normalizing the pixel values of the R, G, and B components in step 2 is expressed as follows: Where, I z is the grayscale encoding matrix of the three channels of pixel values R, G, and B, m,z∈{r,g,b}, (x,y) is the pixel coordinate position.
7. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The raster ID (i, j) of step 3 is expressed in Python as: ID(i,j)=cv2.merge([ID b (i,j),ID g (i,j),ID r (i,j)])。 8. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 1, characterized in that: The process of dynamically changing the key grating IK(i,j) in step 5 is expressed as follows: IK'(i,j)=IK(i,j)+Δr(t) Where Δr(t) is the water ripple dynamic diffusion algorithm, which is expressed as: Δr(t)=Asin(φ(t)) Where A is the amplitude and φ(t) is the phase shift function. By adjusting A and φ(t), the diffusion speed and dynamic changes of the amplitude of the grating ripples can be controlled.
9. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 8, characterized in that: The phase shift function φ(t) is expressed as: ω=θf Where ω represents the angular frequency, θ is the function period parameter, θ=kπ, k∈Z, f is the frequency, is the phase offset parameter, and t is the time.
10. The method for color image hiding and multi-color dynamic display based on special morphological grating according to claim 8, characterized in that: The target color image dynamically displayed in step 5 includes 1 to 16 colors in total. The colors are layered in the HSV color space, and each layer corresponds to the offset of the grating phase.