Image data embedding method and device, equipment, medium and product
By encrypting the data to be embedded and embedding it in blocks into the least significant bits of image pixels, combined with robustness technology, the problems of poor data extraction accuracy and insufficient security in existing technologies are solved. This achieves covert storage and efficient extraction of data, improving the security and efficiency of image data embedding.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-21
AI Technical Summary
Existing technologies suffer from poor data extraction accuracy and insufficient security, which affects the reliability of authorization verification and results in low efficiency of image data embedding.
The encryption algorithm is used to encrypt the data to be embedded. Through block embedding and verification mechanism, the hash character and character block to be embedded are embedded into the least significant bit of the image pixel data. Combined with robust embedding technology, the data can be hidden and accurately extracted.
It improves the security and anti-interference capabilities of data embedding, ensures the integrity and accuracy of data extraction, and enhances the efficiency of image data embedding.
Smart Images

Figure CN121907967A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data embedding, and more particularly to a method, apparatus, device, medium, and product for embedding data into images. Background Technology
[0002] With the development of the internet, the technology of embedding data into images is widely used in various scenarios: In smart cities and enterprise decision-making, large-screen visualizations need to dynamically display data while implicitly conveying authorization information through image carriers. In industrial equipment and chip licensing scenarios, device keys or authorization information need to be transmitted through image carriers. In sensitive data transmission scenarios, data needs to be embedded in images in an opaque form to avoid direct exposure in the transmission link and prevent man-in-the-middle attacks or data leaks.
[0003] Existing technologies primarily embed data into images based on image steganography and digital image processing techniques. First, the structured data to be hidden is formatted as text; then, a Least Significant Bit (LSB) replacement algorithm is used to embed the data bit-by-bit into the least significant bit of the image pixels; finally, the image containing the authorization information is used in the application and authorization verification is performed.
[0004] However, the existing technology suffers from poor data extraction accuracy and insufficient security, which affects the reliability of authorization verification and results in low efficiency of image data embedding. Summary of the Invention
[0005] This application provides a method, apparatus, device, medium, and product for embedding image data, in order to solve the problems of poor data extraction accuracy and insufficient security in the prior art, which affect the reliability of authorization verification and thus lead to low efficiency in image data embedding.
[0006] In a first aspect, this application provides a data embedding method for an image, comprising:
[0007] Obtain the data to be embedded, and obtain the image carrier used to fuse the data to be embedded; wherein, the data to be embedded is structured data;
[0008] Determine the string to be embedded based on the data to be embedded;
[0009] Analyze the image carrier to obtain the pixel data corresponding to the image carrier;
[0010] Based on the string to be embedded, generate the hash character to be embedded and multiple character blocks to be embedded;
[0011] The hash character and the character block to be embedded are embedded into the pixel data to obtain the embedded image data;
[0012] The target image is generated based on the embedded image data.
[0013] In one possible design, based on the string to be embedded, a hash character to be embedded and multiple character blocks to be embedded are generated, including:
[0014] Calculate the hash value of the string to be embedded, and determine the hash value as the hash character to be embedded;
[0015] The string to be embedded is divided into blocks to obtain multiple blocks of characters to be embedded.
[0016] In one possible design, the string to be embedded is divided into blocks to obtain multiple blocks of characters to be embedded, including:
[0017] Convert the string to be embedded into an unsigned integer array;
[0018] Calculate the number of layers required to accommodate an unsigned integer array based on the preset maximum data capacity of a single character block;
[0019] Based on the number of layers, the unsigned integer array is divided into multiple subarrays to form multiple character blocks to be embedded; among them, except for the last character block to be embedded, the data volume of each remaining character block to be embedded is equal to the maximum data capacity.
[0020] In one possible design, the hash character to be embedded and the character block to be embedded are embedded into the pixel data to obtain the embedded image data, including:
[0021] Embed the hash character to be embedded into the preset starting area of the pixel data;
[0022] Multiple character blocks to be embedded are embedded into the least significant bit of the pixel color channel corresponding to the pixel data.
[0023] In one possible design, multiple character blocks to be embedded are embedded into the least significant bit of the pixel color channel corresponding to the pixel data, including:
[0024] Each bit of each byte of data to be embedded is embedded into the least significant bit of the red, green, and blue color channel values of a pixel data.
[0025] In one possible design, the string to be embedded is determined based on the data to be embedded, including:
[0026] The data to be embedded is encrypted using a preset encryption algorithm to obtain encrypted embedded data.
[0027] The encrypted embedded data is encoded to obtain the string to be embedded.
[0028] In one possible design, the default encryption algorithm is a symmetric encryption algorithm.
[0029] In one possible design, after generating the target image based on the embedded image data, the following is also included:
[0030] Extract the hash character and the character block to be embedded from the pixel data of the target image;
[0031] The recombined string is obtained by reorganizing the character block to be embedded, and the integrity of the recombined string is verified by the hash character to be embedded.
[0032] If the integrity verification is successful, the string to be embedded will be restored to the data to be embedded.
[0033] Secondly, this application provides an image data embedding apparatus, comprising:
[0034] The acquisition module is used to acquire the data to be embedded and to acquire the image carrier for fusing the data to be embedded; wherein, the data to be embedded is structured data;
[0035] The first determining module is used to determine the string to be embedded based on the data to be embedded;
[0036] The parsing module is used to parse the image carrier to obtain the pixel data corresponding to the image carrier;
[0037] The first generation module is used to generate the hash character to be embedded and multiple character blocks to be embedded based on the string to be embedded;
[0038] The embedding module is used to embed the hash character and the character block to be embedded into the pixel data to obtain the embedded image data.
[0039] The second generation module is used to generate the target image based on the embedded image data.
[0040] Thirdly, this application provides an image data embedding device, including: a memory and a processor;
[0041] The memory stores the instructions that the computer executes;
[0042] The processor executes computer execution instructions stored in memory, causing the processor to execute the image data embedding method as described in the first aspect of the invention.
[0043] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement a data embedding method for an image as described in the first aspect of the invention.
[0044] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the image data embedding method of the first aspect of the invention.
[0045] This application provides a method, apparatus, device, medium, and product for embedding image data, comprising: acquiring data to be embedded and acquiring an image carrier for fusing the data to be embedded; determining a string to be embedded based on the data to be embedded; parsing the image carrier to obtain pixel data corresponding to the image carrier; generating a hash character to be embedded and multiple character blocks to be embedded based on the string to be embedded; embedding the hash character to be embedded and the character blocks to be embedded into the pixel data to obtain embedded image data; and generating a target image based on the embedded image data. Compared to existing technologies with poor data extraction accuracy and insufficient security, which affect the reliability of authorization verification and thus lead to low image data embedding efficiency, this application achieves covert data storage and accurate extraction under specific environments through a series of operations such as encryption, encoding, and steganography. By combining encryption algorithms with robust embedding technology, data security and anti-interference capabilities are achieved; and by using a block embedding and verification mechanism, the integrity and accuracy of data extraction are ensured. This improves the efficiency of image data embedding. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A schematic diagram of the system architecture of an image data embedding method provided in an embodiment of this application;
[0048] Figure 2 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 1 ;
[0049] Figure 3 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 2 ;
[0050] Figure 4 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 3 ;
[0051] Figure 5 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 4 ;
[0052] Figure 6 This is a schematic diagram of the structure of the image data embedding device provided in the embodiments of this application;
[0053] Figure 7 This is a schematic diagram of the structure of an image data embedding device provided in an embodiment of this application. Detailed Implementation
[0054] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0055] In the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, nor do they necessarily imply difference. It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner. In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more.
[0056] It should be noted that the phrase "at...time" in the embodiments of this application can refer to the instant at which a certain situation occurs, or to a period of time after the occurrence of a certain situation; the embodiments of this application do not specifically limit this. Furthermore, the image data embedding method provided in the embodiments of this application is merely an example, and image data embedding methods may include more or less content.
[0057] The technology of embedding structured data (such as JSON format) into digital images has the following core application scenarios:
[0058] Optional, Visualized Large Screen Authorization Management: In scenarios such as smart cities and enterprise decision-making, visualized large screens need to dynamically display data while implicitly conveying authorization information (such as project validity period, function permissions, device binding, etc.) through image carriers. Traditional methods rely on plaintext authorization files, which are at risk of being tampered with or illegally copied. This application achieves concealed and secure authorization verification by embedding authorization information into images.
[0059] Optional, device authorization and anti-counterfeiting: In scenarios such as industrial equipment and chip authorization, device keys or authorization information need to be transmitted via image carriers. For example, chip authorization files need to be bound to specific devices, and traditional methods are easily copied or forged. However, this application ensures that authorization information can only be extracted through specific devices through encryption and robust processing.
[0060] Optional, secure data transmission: In sensitive data transmission scenarios (such as the medical and financial fields), data should be embedded in images in an opaque form to avoid direct exposure in the transmission link and prevent man-in-the-middle attacks or data leaks.
[0061] In the above scenarios, data embedding technology needs to have high security: preventing data from being maliciously extracted or tampered with; strong robustness: ensuring that the embedded data can still be completely extracted after the image has undergone operations such as compression, cropping, and format conversion; high concealment: the appearance of the image does not change significantly after the data is embedded, avoiding attracting the attention of attackers; and high accuracy: ensuring the integrity of the extracted data to avoid verification failure due to interference.
[0062] Existing technologies are mainly based on image steganography and digital image processing technology. They store the authorization information of structured data (such as JSON) in an image, use the image as a chip authorization for the project, and read the authorization information when the project starts to achieve large-screen authorization.
[0063] Steganography, a crucial technology in the field of information hiding, has a history dating back to ancient times and has been revitalized in the digital age. Image steganography, a key branch of steganography, focuses on data hiding in digital images. Digital images are composed of a large number of pixels, each containing color information and possessing a certain degree of data redundancy. Image steganography utilizes this characteristic to cleverly embed various types of data, such as text, documents, and images, into pixels, making the hidden data visually difficult to detect and ensuring the confidentiality of information transmission. In the context of today's ever-increasing demands for information security, image steganography is widely used in scenarios such as confidential information transmission and copyright protection.
[0064] Digital image processing is a technical field that integrates knowledge from multiple disciplines such as mathematics and computer science. It primarily involves the acquisition, compression, processing, and analysis of digital images. In image steganography, digital image processing technology plays a crucial role. During the data embedding stage, the data to be hidden must be encoded into image pixels using appropriate algorithms, while strictly controlling the impact on image quality to avoid significant distortion caused by data embedding. In the data extraction stage, the original data must be accurately restored from the image according to the embedding rules. Furthermore, image compression technology can reduce image file size while ensuring no loss of hidden information, facilitating storage and transmission.
[0065] Visualized large screens play a vital role in modern data display, monitoring, and command scenarios. By acquiring image paths, display parameters, sizes, and project-related information, they enable more intelligent and personalized presentations. Through dynamically adjusting image display methods and updating image content in real-time, visualized large screens can present complex data to users in an intuitive and clear visual format, improving the efficiency and effectiveness of information delivery. They are widely used in smart cities, enterprise decision-making, and other fields.
[0066] Specifically, in the data preparation phase: Structured data that needs to be hidden (such as JSON) is converted into text format, containing key authorization information (such as validity period, permission scope, etc.). For example, the authorization information for the large screen is organized into JSON format, which includes key content such as the project's validity period, function usage permissions, and device binding information. This information is the core basis for project authorization, ensuring that only projects that meet the authorization conditions can start and run normally.
[0067] Specifically, in the data embedding stage: the LSB replacement algorithm is used to embed data bit by bit into the least significant bit of the image pixels (such as the LSB of the RGB channel). This method utilizes the redundancy of pixel values, achieving data embedding by modifying the least significant bit, with minimal impact on the visual appearance of the image. For example, the Least Significant Bit Replacement algorithm can be used to embed JSON data bit by bit into the least significant bit of the image pixels. Since changes in the least significant bit have minimal impact on image color, the image appears almost unchanged to the naked eye, thus ensuring data concealment. Simultaneously, digital image processing techniques are used to optimize the embedding process, minimizing the impact on image quality.
[0068] Specifically, in the image application stage: the image containing the embedded data is embedded into the project or device as an authorization carrier. During startup or verification, the data is extracted using image processing tools. For example, an image containing authorization information is placed in the project as a chip authorization. When the project starts, the system invokes digital image processing technology to extract hidden JSON data from the image according to pre-defined rules.
[0069] Specifically, in the authorization verification phase: after extracting the data, the JSON content is parsed to verify the legality of the authorization (such as validity period, device binding, etc.). This involves parsing the extracted JSON data and verifying the authorization information within. Verification includes checking if the project's validity period has expired, whether the function usage permissions match, and whether the device information is bound. If the verification passes, the large screen is allowed to start and be used normally; if the verification fails, the relevant functions of the large screen are restricted or prohibited.
[0070] Furthermore, the existing technology has the following technical problems:
[0071] Optionally, security is insufficient: data is directly embedded in image pixels, lacking encryption protection. Attackers can easily extract the data using image processing tools (such as steganalysis software), leading to the leakage of sensitive information.
[0072] Optionally, robustness is poor: LSB algorithms are sensitive to image processing operations (such as compression, filtering, and format conversion), and the embedded data is easily corrupted. For example, JPEG compression causes pixel values to be re-encoded, corrupting the LSB-embedded data.
[0073] Optionally, low extraction accuracy: Existing methods rely on simple algorithms to extract data. If the image is interfered with during transmission or storage (such as noise or cropping), it may lead to data loss or corruption, affecting the reliability of authorization verification.
[0074] Optionally, security and robustness issues can both affect data integrity and availability. For example, even if data is encrypted, if the embedding algorithm is not robust, ciphertext data may still be lost due to image processing, ultimately making decryption impossible.
[0075] Optionally, the issues of extraction accuracy and security are interrelated. If the extraction algorithm cannot accurately reconstruct the data, even if the data is encrypted, erroneous extraction may render the ciphertext undecryptable, thus rendering the algorithm ineffective.
[0076] To address the aforementioned problems, the inventors, during their research on the low efficiency of image data embedding, discovered that existing technologies suffer from poor data extraction accuracy and insufficient security, affecting the reliability of authorization verification and thus leading to low image data embedding efficiency. Therefore, the inventors considered introducing advanced encryption algorithms to encrypt JSON data before embedding it into the image. For example, symmetric or asymmetric encryption algorithms can be used to encrypt the data, ensuring that only authorized parties with the corresponding keys can correctly decrypt and extract the hidden data. This effectively prevents malicious users from illegally obtaining and cracking hidden information, enhancing data security. Based on this, embodiments of this application provide an image data embedding method, apparatus, device, medium, and product, applicable to the field of data embedding, aiming to solve the problem of low image data embedding efficiency in existing technologies.
[0077] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0078] Figure 1 This is a schematic diagram of the system architecture for an image data embedding method provided in an embodiment of this application. The image data embedding system is a computer device. Figure 1 In the above architecture, at least one of data acquisition device 101, processing device 102 and display device 103 is included.
[0079] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the processing system architecture of the image data embedding method. In other feasible embodiments of this application, the above architecture may include more or fewer components than illustrated, or combine some components, or divide some components, or arrange different components, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown can be implemented in hardware, software, or a combination of both.
[0080] In the specific implementation process, the data acquisition device 101 may include an input / output interface or a communication interface. The data acquisition device 101 can be connected to the processing device through the input / output interface or the communication interface to acquire the data to be embedded and the image carrier used to fuse the data to be embedded.
[0081] The processing device 102 can generate a target image based on the acquired data to be embedded and an image carrier used to fuse the data to be embedded.
[0082] The display device 103 can also be a touch screen or the screen of a terminal device, used to receive user commands while displaying the above-mentioned content, so as to realize interaction with the user.
[0083] It should be understood that the aforementioned processing device can be implemented by a processor reading instructions from memory and executing those instructions, or it can be implemented by a chip circuit.
[0084] Furthermore, the network architecture and business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0085] The technical solution of this application will be described in detail below with reference to specific embodiments:
[0086] Figure 2 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 1 ,like Figure 2 As shown, the method includes:
[0087] S201. Obtain the data to be embedded and obtain the image carrier used to fuse the data to be embedded.
[0088] The data to be embedded is structured data.
[0089] Structured data can be in JSON format.
[0090] In this embodiment, the data to be stored is organized into JSON format and represented as text. This allows the data to be embedded to be obtained.
[0091] In this embodiment, a suitable image is selected as the carrier for data embedding, such as input.jpg.
[0092] The image format can be a common format that supports pixel-level operations, such as PNG or JPEG.
[0093] S202. Determine the string to be embedded based on the data to be embedded.
[0094] Specifically, a preset encryption algorithm is used to encrypt the data to be embedded in order to obtain encrypted embedded data;
[0095] The preset encryption algorithm is a symmetric encryption algorithm.
[0096] In this embodiment, to ensure data security, the JSON data needs to be encrypted using an encryption algorithm before embedding it into the image. Here, we take the Advanced Encryption Standard (AES) symmetric encryption algorithm as an example and use the crypto-js library to implement the encryption operation.
[0097] In practical applications, a secure key management method should be used.
[0098] Furthermore, the encrypted embedded data is encoded to obtain the string to be embedded.
[0099] In this embodiment, the encrypted JSON data is encoded into a string for easy embedding into the image later.
[0100] In JavaScript, strings can be used directly.
[0101] For sensitive data, it is first encrypted before being embedded into the image. JSON data is encrypted using either symmetric or asymmetric encryption algorithms, ensuring that only authorized personnel with the corresponding decryption keys can correctly decrypt and extract the data, effectively preventing unauthorized access and data leakage, and improving data security.
[0102] In one possible embodiment, a dynamic encryption key generation mechanism is used.
[0103] Specifically, a dynamic key is generated based on the image content (such as based on the image hash value) to prevent the fixed key from being cracked.
[0104] Among the improvements are enhanced key security: attackers must simultaneously crack both the image and the key generation algorithm. Adaptability: different images use different keys, reducing the risk of key leakage.
[0105] S203. Analyze the image carrier to obtain the pixel data corresponding to the image carrier.
[0106] S204. Based on the string to be embedded, generate the hash character to be embedded and multiple character blocks to be embedded.
[0107] In one possible embodiment, image data is embedded based on asymmetric encryption.
[0108] Specifically, the JSON data is encrypted using the RSA asymmetric encryption algorithm, the public key is embedded in the image, and the private key is kept by the recipient.
[0109] Among these features, enhanced security is achieved because even if an attacker obtains the image, a private key is required for decryption. Adaptability and scalability are also enhanced, making it suitable for multi-user authorization scenarios (e.g., different users possess different private keys).
[0110] S205. Embed the hash character to be embedded and the character block to be embedded into the pixel data to obtain the embedded image data.
[0111] In one possible implementation, deep learning-based embedding location prediction is used.
[0112] Specifically, a neural network model is trained to predict the pixel locations in an image that are suitable for data embedding (such as areas with small color changes).
[0113] Among these features, automated optimization involves the model automatically selecting the optimal embedding location, reducing manual intervention. Enhanced concealment results in more concealed embedding locations, lowering the probability of detection.
[0114] S206. Generate the target image based on the embedded image data.
[0115] In this embodiment, the image with embedded data is saved to the file system. In a browser environment, a canvas can be used to convert an ImageData object into an image and save it.
[0116] It should also be noted that this embodiment includes strict access control measures to restrict access to the embedded images. Through user authentication and permission management, it is ensured that only authorized users can access and extract hidden data from the images. For example, at project startup, verification is performed using device fingerprints, user account passwords, and other information. Only verified users can trigger data extraction operations, ensuring data security and privacy.
[0117] This embodiment provides an image data embedding method, including: acquiring data to be embedded and acquiring an image carrier for fusing the data to be embedded; determining a string to be embedded based on the data to be embedded; parsing the image carrier to obtain pixel data corresponding to the image carrier; generating a hash character to be embedded and multiple character blocks to be embedded based on the string to be embedded; embedding the hash character to be embedded and the character blocks to be embedded into the pixel data to obtain embedded image data; and generating a target image based on the embedded image data. Compared to existing technologies, which suffer from poor data extraction accuracy and insufficient security, affecting the reliability of authorization verification and resulting in low image data embedding efficiency, this application achieves covert data storage and accurate extraction under specific environments through a series of operations such as encryption, encoding, and steganography. By combining encryption algorithms with robust embedding techniques, data security and anti-interference capabilities are achieved; and by using a block embedding and verification mechanism, the integrity and accuracy of data extraction are ensured. This improves the efficiency of image data embedding.
[0118] Figure 3 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 2 ,like Figure 3 As shown, step S204 specifically includes:
[0119] S301. Calculate the hash value of the string to be embedded, and determine the hash value as the hash character to be embedded.
[0120] In this example, the hash value of the string to be embedded is calculated and generated using a hash algorithm and the Message-Digest Algorithm 5 (MD5), and this hash value is determined as the hash character to be embedded.
[0121] For example, the ciphertext is encoded into a UTF-8 byte stream, and its MD5 hash value is calculated.
[0122] S302. Convert the string to be embedded into an unsigned integer array.
[0123] S303. Calculate the number of layers required to accommodate an unsigned integer array based on the preset maximum data capacity of a single character block.
[0124] The maximum data capacity is the maximum data length of each layer.
[0125] S304. Based on the number of layers, divide the unsigned integer array into multiple subarrays to form multiple character blocks to be embedded.
[0126] Except for the last character block to be embedded, the data volume of each of the remaining character blocks to be embedded is equal to the maximum data capacity.
[0127] For example, the byte stream can be divided into blocks (such as embedding one block every 255×255 pixels).
[0128] In one possible embodiment, image data embedding is based on multimodal steganography.
[0129] Specifically, by combining LSB with frequency domain steganography, encrypted data is simultaneously embedded into pixel LSB and DCT coefficients.
[0130] Among its features are dual protection: even if one steganography method is compromised, the other can still extract the data. Capacity enhancement: it utilizes both pixel redundancy and frequency domain redundancy to improve data embedding capacity.
[0131] In one possible embodiment, adaptive optimization of frequency domain embedding.
[0132] Specifically, the embedding position of DCT coefficients is dynamically adjusted based on the complexity of the image texture (e.g., embedding more data in complex regions).
[0133] Among these improvements, robustness is enhanced by making the frequency domain coefficients in complex regions more stable and strengthening the anti-interference ability of embedded data. Capacity optimization involves reducing data embedding in visually sensitive areas of the image to decrease perceived distortion.
[0134] In this embodiment, by calculating the hash value of the string to be embedded as an identifier, converting the string into an unsigned integer array, dynamically calculating the number of layers based on the preset maximum data capacity, and dividing the subarray into multiple character blocks (all except the last block are full capacity), the dual optimization of hash verification and capacity adaptation during the data embedding process is achieved. This ensures the reliability of data integrity verification and improves storage space utilization and embedding efficiency through precise control of block capacity.
[0135] Figure 4 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 3 ,like Figure 4 As shown, the specific implementation steps of S205 above include:
[0136] S401. Embed the hash character to be embedded into the preset starting area of the pixel data.
[0137] In this embodiment, the hash character to be embedded is embedded into the first layer of the preset starting area of the pixel data.
[0138] In this process, an MD5 hash value is generated and embedded into the first layer of the image for subsequent verification of data integrity. During the extraction phase, the data is accurately reconstructed based on the embedding rules and verification information, preventing data corruption or loss due to interference during image processing, storage, or transmission.
[0139] In this process, a hash value or checksum is attached when embedding data, and the integrity of the data is verified after extraction to avoid data loss due to image interference.
[0140] In one possible embodiment, image data is embedded based on blockchain.
[0141] Specifically, the hash value of the embedded image is uploaded to the blockchain as proof of data integrity.
[0142] Among these features are: Immutability: The blockchain records hash values to ensure that the images have not been tampered with; Traceability: The hash values are used to verify the source of the data, enhancing the legitimacy of authorization.
[0143] S402. Embed multiple character blocks to be embedded into the least significant bit of the pixel color channel corresponding to the pixel data.
[0144] Specifically, each bit of each byte of the data to be embedded is embedded into the least significant bit of the red, green, and blue color channel values of a pixel data.
[0145] Specifically, the process iterates through the pixels and assigns each bit of each byte of data to be embedded to the least significant bit of the red, green, and blue color channel (RGB channel) value of a pixel.
[0146] Taking Least Significant Bit (LSB) steganography as an example, data is embedded by cleverly modifying the least significant bit of a pixel. Since changes to the least significant bit have minimal impact on the pixel value, the image appears almost unchanged to the naked eye, thus minimizing the impact on the appearance of the carrier image and ensuring that image quality is not compromised. Furthermore, the strength and method of data embedding are adaptively adjusted according to the content and characteristics of the image, further optimizing image quality.
[0147] This method cleverly integrates data into image pixels, making the embedded data visually inconspicuous and difficult to detect. It utilizes the redundancy of images, such as low-order values in color channels, to disperse the embedded data, preventing concentrated modifications from causing obvious image anomalies. Furthermore, it combines image preprocessing and post-processing techniques to further enhance the data's concealment.
[0148] In this embodiment, data positioning is achieved by fixing the hash character to be embedded in the starting area of the pixel. Multiple character blocks are split into bit sequences in bytes and embedded bit by bit according to the least significant bit of the red, green and blue channels. This achieves the following while ensuring that the visual quality of the image remains basically unchanged: the integrity verification and position anchoring of the embedded data are completed through the hash character. At the same time, the storage efficiency is improved to 3 bits per pixel through the three-channel least significant bit bit plane multiplexing technology. The block embedding strategy adapts to the efficient storage requirements of data with different capacities. Finally, the triple optimization goals of high capacity, low distortion and strong verification in covert communication are achieved.
[0149] Figure 5 A flowchart illustrating an image data embedding method provided in this application embodiment. Figure 4 ,like Figure 5 As shown, after step S206 above, the following is also included:
[0150] S501. Extract the hash character to be embedded and the character block to be embedded from the pixel data of the target image.
[0151] S502. Perform reorganization processing on the character block to be embedded to obtain the reorganized string, and perform integrity verification on the reorganized string based on the hash character to be embedded.
[0152] S503. If the integrity verification is successful, the string to be embedded will be restored to the data to be embedded.
[0153] In this embodiment, in a specific environment where data needs to be extracted, an appropriate algorithm is used to extract encrypted data (hash characters to be embedded and character blocks to be embedded) from the image, and the same key is used for decryption.
[0154] In this embodiment, by accurately extracting the hash characters and character blocks to be embedded from pixel data, and restoring the string after recombination, the integrity is verified using preset hash characters. If the verification is successful, the original data is finally restored. This achieves a closed-loop control of the entire chain of data extraction, recombination, verification, and restoration. It ensures the reliability of the data source through the fixed position and uniqueness of the hash characters, and ensures that the integrity of the data is not destroyed during transmission or storage through the block embedding and recombination strategy of character blocks. Ultimately, it achieves the three core advantages of high accuracy, strong anti-interference and verifiability in the extraction of hidden information while ensuring that the image is visually intact.
[0155] This application also provides a possible embodiment, assuming we have a carrier image named input.jpg, and we need to embed JSON data containing user information: {"name":"John","age":30,"city":"NewYork"} into it. Follow the steps described above as follows:
[0156] First, the JSON data is encrypted using the AES algorithm.
[0157] Secondly, the encrypted data is encoded into a string.
[0158] Next, LSB steganography is used to embed the data into the pixels of input.jpg.
[0159] Then, save the modified image as output.png.
[0160] Finally, in the environment where data needs to be extracted, the encrypted data is extracted from output.png and decrypted using the same key to obtain the original JSON data.
[0161] In this embodiment, AES encryption ensures the security of user JSON data transmission. LSB steganography is used to embed encrypted data into the least significant bit of image pixels to achieve visually lossless and covert storage. The data is then saved in PNG lossless format to ensure data integrity. Finally, the original data is decrypted and restored at the extraction end using the same key. This achieves a secure and controllable end-to-end process from encryption to embedding to storage to extraction to decryption. This ensures the high degree of concealment of data in public carriers and provides anti-interception and anti-tampering capabilities during transmission through the dual protection mechanism of encryption and steganography. At the same time, the lossless nature of the PNG format ensures that the steganographic data can still be accurately restored after multiple edits. Ultimately, this achieves the three-dimensional optimization goal of security, concealment, and verifiability in covert communication.
[0162] Figure 6 This is a schematic diagram of the structure of the image data embedding device provided in the embodiments of this application, as shown below. Figure 6 As shown, the device includes: an acquisition module 61, a first determination module 62, a parsing module 63, a first generation module 64, an embedding module 65, and a second generation module 66.
[0163] The acquisition module 61 is used to acquire the data to be embedded and to acquire the image carrier for fusing the data to be embedded; wherein the data to be embedded is structured data.
[0164] The first determining module 62 is used to determine the string to be embedded based on the data to be embedded;
[0165] The parsing module 63 is used to parse the image carrier to obtain the pixel data corresponding to the image carrier;
[0166] The first generation module 64 is used to generate a hash character to be embedded and multiple character blocks to be embedded based on the string to be embedded;
[0167] Embedding module 65 is used to embed the hash character to be embedded and the character block to be embedded into the pixel data to obtain the embedded image data;
[0168] The second generation module 66 is used to generate the target image based on the embedded image data.
[0169] In one possible design, based on the string to be embedded, a hash character to be embedded and multiple character blocks to be embedded are generated, including:
[0170] The first generation module 64 is also used to calculate the hash value of the string to be embedded and determine the hash value as the hash character to be embedded;
[0171] The string to be embedded is divided into blocks to obtain multiple blocks of characters to be embedded.
[0172] In one possible design, the string to be embedded is divided into blocks to obtain multiple blocks of characters to be embedded, including:
[0173] The first generation module 64 is also used to convert the string to be embedded into an array of unsigned integers;
[0174] Calculate the number of layers required to accommodate an unsigned integer array based on the preset maximum data capacity of a single character block;
[0175] Based on the number of layers, the unsigned integer array is divided into multiple subarrays to form multiple character blocks to be embedded; among them, except for the last character block to be embedded, the data volume of each remaining character block to be embedded is equal to the maximum data capacity.
[0176] In one possible design, the hash character to be embedded and the character block to be embedded are embedded into the pixel data to obtain the embedded image data, including:
[0177] The embedding module 65 is also used to embed the hash character to be embedded into a preset starting area of the pixel data;
[0178] Multiple character blocks to be embedded are embedded into the least significant bit of the pixel color channel corresponding to the pixel data.
[0179] In one possible design, multiple character blocks to be embedded are embedded into the least significant bit of the pixel color channel corresponding to the pixel data, including:
[0180] The embedding module 65 is also used to embed each bit of each byte of the data to be embedded into the least significant bit of the red, green and blue color channel values of a pixel data, respectively.
[0181] In one possible design, the string to be embedded is determined based on the data to be embedded, including:
[0182] The first determining module 62 is also used to encrypt the data to be embedded using a preset encryption algorithm to obtain encrypted embedded data.
[0183] The encrypted embedded data is encoded to obtain the string to be embedded.
[0184] In one possible design, the default encryption algorithm is a symmetric encryption algorithm.
[0185] In one possible design, after generating the target image based on the embedded image data, the following is also included:
[0186] Extract the hash character and the character block to be embedded from the pixel data of the target image;
[0187] The recombined string is obtained by reorganizing the character block to be embedded, and the integrity of the recombined string is verified by the hash character to be embedded.
[0188] If the integrity verification is successful, the string to be embedded will be restored to the data to be embedded.
[0189] This embodiment provides an image data embedding device that can execute an image data embedding method described in the above embodiment. Its implementation principle and technical effects are similar, and will not be repeated here.
[0190] In a specific implementation of the aforementioned image data embedding method, each module can be implemented as a processor. The processor can execute computer execution instructions stored in the memory, thereby enabling the processor to execute the aforementioned image data embedding method.
[0191] Figure 7 This is a schematic diagram of the structure of an image data embedding device provided in an embodiment of this application. Figure 7 As shown, the image data embedding device 70 includes at least one processor 71 and a memory 72. The image data embedding device 70 also includes a communication component 73. The processor 71, memory 72, and communication component 73 are connected via a bus 74.
[0192] In a specific implementation, at least one processor 71 executes computer execution instructions stored in memory 72, causing at least one processor 71 to execute a data embedding method executed on the data embedding device side as shown in the above image.
[0193] The specific implementation process of processor 71 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0194] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0195] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.
[0196] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0197] The functions implemented by the image data embedding device and the main control device described above illustrate the solution provided by the embodiments of the present invention. It is understood that, in order to achieve the above functions, the image data embedding device or the main control device includes hardware structures and / or software modules corresponding to the execution of each function. By combining the units and algorithm steps of the various examples described in the embodiments of the present invention, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solution of the embodiments of the present invention.
[0198] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method in the field of data embedding described above.
[0199] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0200] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in an image data embedding device or a host device.
[0201] This application also provides a computer program product comprising: a computer program stored in a readable storage medium, at least one processor of an image data embedding device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program causing the image data embedding device to perform the scheme provided in any of the above embodiments.
[0202] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disk, or optical disk.
[0203] The technical solutions of this application have been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it is readily understood by those skilled in the art that the scope of protection of this application is obviously not limited to these specific embodiments. The above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for embedding image data, characterized in that, include: Obtain the data to be embedded, and obtain an image carrier for fusing the data to be embedded; wherein the data to be embedded is structured data; Based on the data to be embedded, determine the string to be embedded; The image carrier is parsed to obtain the pixel data corresponding to the image carrier; Based on the string to be embedded, generate a hash character to be embedded and multiple character blocks to be embedded; The hash character to be embedded and the character block to be embedded are embedded into the pixel data to obtain the embedded image data; The target image is generated based on the embedded image data.
2. The method according to claim 1, characterized in that, The step of generating a hash character to be embedded and multiple character blocks to be embedded based on the string to be embedded includes: Calculate the hash value of the string to be embedded, and determine the hash value as the hash character to be embedded; The string to be embedded is divided into blocks to obtain multiple character blocks to be embedded.
3. The method according to claim 2, characterized in that, The step of dividing the string to be embedded into blocks to obtain multiple blocks of characters to be embedded includes: Convert the string to be embedded into an unsigned integer array; Calculate the number of layers required to accommodate the unsigned integer array based on the preset maximum data capacity of a single character block; Based on the number of layers, the unsigned integer array is divided into multiple subarrays to form multiple character blocks to be embedded; wherein, except for the last character block to be embedded, the data volume of each remaining character block to be embedded is equal to the maximum data capacity.
4. The method according to claim 3, characterized in that, The step of embedding the hash character to be embedded and the character block to be embedded into the pixel data to obtain the embedded image data includes: The hash character to be embedded is embedded into a preset starting area of the pixel data; The plurality of character blocks to be embedded are embedded into the least significant bit of the pixel color channel corresponding to the pixel data.
5. The method according to claim 4, characterized in that, The step of embedding the plurality of character blocks to be embedded into the least significant bit of the pixel color channel corresponding to the pixel data includes: Each bit of each byte of data to be embedded is embedded into the least significant bit of the red, green, and blue color channel values of a pixel data.
6. The method according to any one of claims 1 to 5, characterized in that, The step of determining the string to be embedded based on the data to be embedded includes: The data to be embedded is encrypted using a preset encryption algorithm to obtain encrypted embedded data. The encrypted embedded data is encoded to obtain the string to be embedded.
7. The method according to claim 6, characterized in that, The preset encryption algorithm is a symmetric encryption algorithm.
8. The method according to any one of claims 1 to 5, characterized in that, After generating the target image based on the embedded image data, the method further includes: Extract the hash character to be embedded and the character block to be embedded from the pixel data of the target image; The recombined string is obtained by reorganizing the character block to be embedded, and the integrity of the recombined string is verified by the hash character to be embedded. If the integrity verification is successful, the string to be embedded will be restored to the data to be embedded.
9. An image data embedding device, characterized in that, include: An acquisition module is used to acquire the data to be embedded and to acquire an image carrier for fusing the data to be embedded; wherein the data to be embedded is structured data; The first determining module is used to determine the string to be embedded based on the data to be embedded; The parsing module is used to parse the image carrier to obtain the pixel data corresponding to the image carrier; The first generation module is used to generate a hash character to be embedded and multiple character blocks to be embedded based on the string to be embedded; An embedding module is used to embed the hash character to be embedded and the character block to be embedded into the pixel data to obtain embedded image data; The second generation module is used to generate a target image based on the embedded image data.
10. An image data embedding device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-8.
12. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-8.