An image processing method and system based on digital watermarking
By using digital watermarking processing methods at the vehicle terminal and server end, and by splitting and merging images using color gamut channels to generate and verify watermark data, the problems of insufficient robustness and high computational complexity in existing technologies are solved, thus achieving data concealment protection and prevention of data tampering.
Patent Information
- Application Number
- CN202411279522.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2044-09-12
AI Technical Summary
Existing digital watermarking methods in the vehicle field suffer from insufficient robustness, high computational complexity, high risk of image distortion, and high implementation complexity, making it difficult to effectively prevent data tampering and damage.
By acquiring the original watermark data and the image to be processed, the first verification data and the first watermark data are generated. The image is split into multiple color gamut maps according to the color gamut channels, the watermark data is replaced in the preset position, the color gamut maps are merged, and the images are sent to the server for verification.
While ensuring the visual quality of the images, it achieves data concealment protection, ensures the verifiability of the images during transmission, minimizes interference with the original data, and effectively prevents data tampering and damage.
Smart Images

Figure CN119205476B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of digital watermarking, and particularly relates to an image processing method and system based on digital watermarking. BACKGROUND
[0002] Picture digital watermarking technology has been widely used in copyright protection, information security and anti-counterfeiting, advertising marketing and tracking, and content verification and integrity protection. In the aspect of copyright protection, digital watermarking technology effectively prevents illegal copying and piracy of digital works by embedding copyright information; in the field of information security and anti-counterfeiting, digital watermarking technology is used to protect the authenticity and integrity of important information or products, prevent information from being tampered with or forged; at the same time, the technology is also used for advertising marketing and tracking to help advertisers accurately evaluate the advertising effect; in the aspect of content verification and integrity protection, digital watermarking technology ensures the authenticity and integrity of digital media content.
[0003] In the field of vehicles, the collected pictures are usually directly sent to the picture receiver, and some related technologies mainly use the least significant bit algorithm (LSB), transform domain method and zero watermark technology to process the pictures. However, these technologies have the following shortcomings: 1. The robustness of LSB is not strong, and it is easy to be attacked, and the receiver cannot distinguish whether the picture has been tampered with or data has been lost; 2. The transform domain method has high computational complexity, requires high processing equipment, and may also cause image distortion; 3. The implementation complexity of zero watermark technology is high, and in some cases it may be difficult to find enough stable features in the original picture to construct a watermark. Obviously, there is an urgent need for a new image processing method based on digital watermarking to solve at least one of the above problems.
[0004] It should be noted that the above content only provides background technical information related to the present application, and does not necessarily constitute prior art. SUMMARY
[0005] In view of the above-mentioned shortcomings of the prior art, the present application provides an image processing method and system based on digital watermarking to realize data protection and effectively prevent data tampering and damage risks on the basis of ensuring the visual quality of the image.
[0006] Other characteristics and advantages of the present application will become apparent from the following detailed description, or will be learned by practice of the present application.
[0007] According to an aspect of an embodiment of the present application, an image processing method based on digital watermark is provided, which is applied to a vehicle terminal, and the method comprises the following steps: obtaining original watermark data and a to-be-processed image; generating first check data according to the original watermark data, and generating first watermark data according to the original watermark data and the first check data; splitting the to-be-processed image into a plurality of first color gamut images according to a color gamut channel, replacing the first watermark data to a preset data position in any first color gamut image, and performing channel merging on each first color gamut image to obtain a target watermark image; and sending at least part of the first watermark data and the target watermark image to a server end, wherein the server end is configured to extract second watermark data from the target watermark image, and verify the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data.
[0008] In an embodiment of the present application, based on the foregoing scheme, before the original watermark data is obtained, the method further comprises the following steps: obtaining a timestamp of collecting the to-be-processed image, vehicle information corresponding to the vehicle terminal, and user information; and determining the original watermark data according to at least one of the timestamp, the vehicle information, and the user information.
[0009] In an embodiment of the present application, based on the foregoing scheme, after the first watermark data is generated according to the original watermark data and the first check data, the method further comprises the following steps: obtaining a first total pixel of the to-be-processed image, and calculating a first data length required by the first total pixel; comparing the first data length with a second data length corresponding to the first watermark data; if the first data length is greater than or equal to the second data length, splitting the to-be-processed image into a plurality of first color gamut images according to a color gamut channel; and if the first data length is less than the second data length, ending the image processing of the to-be-processed image.
[0010] In an embodiment of the present application, based on the foregoing scheme, splitting the to-be-processed image into a plurality of first color gamut images according to a color gamut channel, and replacing the first watermark data to a preset data position in any first color gamut image, comprises the following steps: obtaining a first image dimension number of the to-be-processed image; if it is determined that the to-be-processed image is a grayscale image according to the first image dimension number, replacing the first watermark data to a preset data position in any first color gamut image; and if it is determined that the to-be-processed image is not a grayscale image according to the first image dimension number, splitting the to-be-processed image into a plurality of first color gamut images according to a color gamut channel, calculating a remainder according to the length of the original watermark data and a preset number, determining a target first color gamut image according to the correspondence between the remainder and the first color gamut image, and replacing the first watermark data to a preset data position in the target first color gamut image.
[0011] In an embodiment of the present application, based on the foregoing scheme, the method further comprises: extracting a first region image from the to-be-processed image according to a preset extraction rule, performing image recognition on the first region image to obtain first image information; and sending the first image information to the server end, wherein the server end is configured to extract a second region image from the target watermark image according to the preset extraction rule, perform image recognition on the second region image to obtain second image information, compare the first image information with the second image information, and verify the consistency of the to-be-processed image and the target watermark image according to a comparison result.
[0012] According to an aspect of an embodiment of the present application, a digital watermark-based image processing method is provided, applied to a server end, and the method comprises: receiving at least part of first watermark data and a target watermark image sent by a vehicle terminal, wherein the vehicle terminal is configured to acquire original watermark data and a to-be-processed image, generate first check data according to the original watermark data, and generate the first watermark data according to the original watermark data and the first check data, split the to-be-processed image into a plurality of first color gamut images according to color gamut channels, replace the first watermark data to a preset data position in any first color gamut image, and perform channel merging on the first color gamut images to obtain the target watermark image, and send at least part of the first watermark data and the target watermark image to the server end; extract second watermark data from the target watermark image, and verify the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data.
[0013] In an embodiment of the present application, based on the foregoing scheme, extracting second watermark data from the target watermark image comprises: acquiring a second image dimension number of the target watermark image; if it is determined that the target watermark image is a grayscale image according to the second image dimension number, extracting the second watermark data from the target watermark image; and if it is determined that the target watermark image is not a grayscale image according to the second image dimension number, splitting the target watermark image into a plurality of second color gamut images according to color gamut channels, and extracting the second watermark data in a preset data position of a target second color gamut image, wherein the target second color gamut image is determined according to a correspondence relationship between a length of the original watermark data and a remainder of a preset number and the second color gamut images.
[0014] In an embodiment of the present application, based on the foregoing scheme, after the second watermark data is extracted from the target watermark image, the method further comprises: calculating a first watermark length of the first watermark data according to a length of the original watermark data and a length of the first check data; comparing the first watermark length with a second watermark length of the second watermark data, and if the second watermark length is less than the first watermark length, generating an abnormality check prompt to prompt the user; and if the second watermark length is greater than or equal to the first watermark length, verifying the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data.
[0015] In an embodiment of the present application, based on the foregoing scheme, verifying the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data comprises: comparing at least part of the first watermark data with the second watermark data to obtain a comparison result; if the comparison result is that at least part of the first watermark data is the same as the corresponding part of the second watermark data, determining that the watermark data is consistent; and if the comparison result is that at least part of the first watermark data is not the same as the corresponding part of the second watermark data, determining that the watermark data is inconsistent.
[0016] According to an aspect of an embodiment of the present application, there is provided an image processing system based on digital watermarking, comprising: a vehicle terminal configured to acquire original watermark data and an image to be processed, generate first check data according to the original watermark data, and generate first watermark data according to the original watermark data and the first check data, split the image to be processed into a plurality of first color gamut images according to color gamut channels, replace the first watermark data to a preset data position in any first color gamut image, and perform channel merging on each first color gamut image to obtain a target watermark image, and send at least part of the first watermark data and the target watermark image to a server terminal; and a server terminal configured to extract second watermark data from the target watermark image, and verify the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data.
[0017] The beneficial effects of the present application: the present application obtains original watermark data and an image to be processed, generates first check data according to the original watermark data, and generates first watermark data according to the original watermark data and the first check data, splits the image to be processed into a plurality of first color gamut images according to color gamut channels, replaces the first watermark data to a preset data position in any first color gamut image, and performs channel merging on the first color gamut images to obtain a target watermark image, and sends at least part of the first watermark data and the target watermark image to a server end, wherein the server end is used to extract second watermark data from the target watermark image, and verifies the consistency of the watermark data according to the comparison result between at least part of the first watermark data and the second watermark data. The visual quality of the image is maintained, the hidden data protection is realized, the verifiability of the image in the transmission or storage process is ensured, the interference on the original data is minimized, and the risk of data tampering and damage is effectively prevented.
[0018] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0019] The drawings incorporated into the specification and forming part of the specification, show embodiments consistent with the present application, and together with the specification, serve to explain the principles of the present application. It is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. In the drawings:
[0020] Figure 1 is a schematic diagram of an exemplary system architecture shown by an exemplary embodiment of the present application;
[0021] Figure 2 is a flowchart of a digital watermark-based image processing method shown by an exemplary embodiment of the present application;
[0022] Figure 3 is a digital watermark embedding process diagram of a digital watermark-based image processing method shown by an exemplary embodiment of the present application;
[0023] Figure 4 is a digital watermark extraction and verification process diagram of a digital watermark-based image processing method shown by an exemplary embodiment of the present application;
[0024] Figure 5 is a block diagram of a digital watermark-based image processing system shown by an exemplary embodiment of the present application;
[0025] Figure 6A structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application is shown. DETAILED DESCRIPTION
[0026] The present application will be described with reference to the attached drawings and preferred embodiments. Other advantages and benefits of the present application will become apparent to those skilled in the art from this disclosure, and from the description of the preferred embodiments. The present application can be implemented in various ways, and can be applied to various embodiments without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, and are not intended to limit the scope of protection of the present application.
[0027] It should be noted that the diagrams provided in the following embodiments are only for illustrating the basic concept of the present application, and only show the components related to the present application in the diagrams, but are not drawn according to the number, shape and size of the components in actual implementation. The shape, number and proportion of the components in actual implementation can be changed arbitrarily, and the layout of the components can be more complex.
[0028] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details, and in other embodiments, the known structures and devices are shown in the form of block diagrams instead of details, to avoid making the embodiments of the present application difficult to understand.
[0029] First of all, it should be noted that the least significant bit algorithm (LSB) is an algorithm commonly used in image steganography. It realizes the hiding of information by embedding secret information into the least significant bit (also known as the least significant bit) of the pixel value of the carrier image. Since the least significant bit has the least impact on the overall quality of the image, changing the data in this position usually does not cause a significant decrease in image quality, thereby realizing the invisibility of information.
[0030] The CRC-32 (Cyclic Redundancy Check 32-bit) algorithm is a widely used cyclic redundancy check (CRC) algorithm. This algorithm generates a 32-bit check code to detect errors in data during transmission or storage, thereby ensuring data integrity and reliability. The CRC-32 algorithm treats data as a large binary number, which is divided by another predefined "generator polynomial", and then returns the remainder as the CRC value. This process is similar to long division, but it is performed in the binary world using the XOR operation instead of subtraction. The generator polynomial is usually represented as a 32-bit binary number in the context of CRC-32, representing the coefficients of a polynomial.
[0031] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.
[0032] Referring to Figure 1 As shown in the figure, the system architecture can include a data acquisition device 101 and a computer device 102. The computer device 102 can be at least one of a desktop graphic processing unit (GPU) computer, a GPU computing cluster, a neural network computer, etc. The data acquisition device 101 is used to acquire raw watermark data and an image to be processed. In this embodiment, the data acquisition device 101 provides the above data to the computer device 102 for processing after acquiring the data. The computer device 102 can be used by a person skilled in the art to generate first check data according to the raw watermark data, generate first watermark data according to the raw watermark data and the first check data, split the image to be processed into a plurality of first gamut images according to the color gamut channel, replace the first watermark data to a preset data position in any first gamut image, and perform channel merging on each first gamut image to obtain a target watermark image. At least a part of the first watermark data and the target watermark image are sent to a server end, wherein the server end is used to extract second watermark data from the target watermark image, and verify the consistency of the watermark data according to the comparison result between at least a part of the first watermark data and the second watermark data. It should be noted that the data acquisition device 101 and the computer device 102 provided in this embodiment are only an example, and should not limit the functions and use range of the embodiments of the present application.
[0033] It should be noted that the image processing method based on digital watermark provided in the embodiments of the present application is generally executed by the computer device 102, and correspondingly, the image processing system based on digital watermark is generally arranged in the computer device 102.
[0034] Figure 2is a flowchart of a digital watermark-based image processing method shown in an example embodiment of the present application, which can be executed by a computing processing device, which can be the computer device 102 shown in the Figure 1 application. Referring to the Figure 2 application, the digital watermark-based image processing method is applied to a vehicle terminal, and at least includes steps S210 to S240, which are described in detail as follows:
[0035] In step S210, original watermark data and an image to be processed are acquired.
[0036] In an embodiment of the present application, before the original watermark data is acquired, a timestamp of acquisition of the image to be processed, vehicle information corresponding to the vehicle terminal, and user information are acquired; and the original watermark data is determined according to at least one of the timestamp, the vehicle information, and the user information.
[0037] In the embodiment, the vehicle information includes but is not limited to at least one of basic information of the vehicle, ownership and registration information of the vehicle, the basic information includes but is not limited to one or more of a vehicle identification number (VIN code), a license plate number, a vehicle type, a brand and a model, a production date, the ownership and registration information includes but is not limited to one or more of owner information, a registration date, a vehicle state, and a driving license information, preferably, the vehicle information includes the vehicle identification number; and the user information includes but is not limited to one or more of a user name, a contact method, etc. It should be noted that the user data such as the vehicle information and the user information acquired in the embodiment of the present application are acquired under the condition that the user is obtained, or are actively submitted after the user-related instructions, or are necessarily uploaded when the user uses the corresponding application program through the client, the webpage, etc. In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure, and application of the user's personal information involved in the technical solution all comply with the relevant legal regulations, necessary security measures are taken, and the public order and good customs are not violated.
[0038] In the embodiment, the image to be processed can be acquired by an image acquisition device of the vehicle corresponding to the vehicle terminal, or can be sent after being processed by the vehicle terminal. The original watermark data and the image to be processed have a corresponding relationship, for example, the original watermark data contains the related information of the vehicle terminal for acquiring or processing the image to be processed.
[0039] In step S220, first check data is generated according to the original watermark data, and first watermark data is generated according to the original watermark data and the first check data.
[0040] In the embodiment, the manner of generating the first watermark data according to the original watermark data and the first check data includes: splicing the original watermark data and the first check data to obtain the first watermark data, or calculating the original watermark data and the first check data according to a preset algorithm to obtain the first watermark data.
[0041] In the embodiment, the original watermark data is converted into binary data, the first check data is generated according to the original watermark data through a cyclic redundancy check algorithm, and the first watermark data is generated according to the binary data and the first check data.
[0042] In the embodiment, taking splicing the binary data and the first check data to obtain the first watermark data as an example. The original watermark data T is converted into binary data B, and the binary data B is spliced with the first check code data crcData to obtain the first watermark data M to be embedded.
[0043] In the embodiment, the first check code crcData, that is, the first check data, is obtained by processing the original watermark data T through a cyclic redundancy check algorithm (for example, a CRC-32 algorithm). The steps of the processing process of the CRC-32 algorithm are as follows:
[0044] ①Initialize a 32-bit register to all 1s (that is, 0xFFFFFFFF). This register is used to store the intermediate results in the CRC check process.
[0045] ②Data processing: process the original watermark data T byte by byte (8 bits). For each byte, perform an exclusive OR operation with the lowest 8 bits of the current CRC register. Then, perform a bitwise modulo 2 operation on the result and the generator polynomial (that is, perform polynomial division through the XOR operation). Move the CRC register one bit to the right and fill the highest bit with 0. Repeat the above process until all 8 bits of the byte are processed.
[0046] ③Repeat step ② until all bytes are processed.
[0047] ④After processing the last byte, perform an exclusive OR operation on the CRC register and 0xFFFFFFFF to obtain the final result, which is the first check code.
[0048] In an embodiment of the present application, the first total pixel of the to-be-processed image is obtained, and the first total pixel is calculated to occupy a first data length; the first data length is compared with a second data length corresponding to the first watermark data; if the first data length is greater than or equal to the second data length, the to-be-processed image is split into a plurality of first gamut images according to a gamut channel; if the first data length is less than the second data length, the image processing of the to-be-processed image is ended.
[0049] In the embodiment, since the total pixels of the image to be processed before and after being split into multiple first gamut images according to the gamut channel are not changed, determining whether the image to be processed has enough space to embed the first watermark data is equivalent to determining whether the first grayscale image P has enough space to embed the first watermark data M. The determination basis is that the first total pixel of the first grayscale image P or the image to be processed is calculated, and according to the corresponding relationship between the pixel size and the byte size, the first data length required by the first total pixel can be calculated (assuming that 1 pixel size is equal to 1 byte), and the first data length is compared with the second data length of the first watermark data M. If the first data length is greater than or equal to the second data length, the next step is performed, that is, the image to be processed is split into multiple first gamut images according to the gamut channel; if the first data length is less than the second data length, an exception is thrown, and the entire processing flow is terminated.
[0050] In step S230, the image to be processed is split into multiple first gamut images according to the gamut channel, the first watermark data is replaced into the preset data position in any first gamut image, and the first gamut images are merged to obtain the target watermark image.
[0051] In an embodiment of the present application, the first image dimension number of the image to be processed is obtained; if it is determined according to the first image dimension number that the image to be processed is a grayscale image, the first watermark data is replaced into the preset data position in any first gamut image; if it is determined according to the first image dimension number that the image to be processed is not a grayscale image, the image to be processed is split into multiple first gamut images according to the gamut channel, a remainder is calculated according to the length of the original watermark data and the preset number, a target first gamut image is determined according to the corresponding relationship between the remainder and the first gamut image, and the first watermark data is replaced into the preset data position in the target first gamut image.
[0052] In the embodiment, whether the original image data, i.e., the image to be processed, is a grayscale image can be determined by using the cv2 library of python. Specifically, the image processing framework cv2 of python is referenced, and the image data is read by calling cv2.imread(path) to obtain an image image. If the image dimension number image.shape is 2, it is a grayscale image. If the image dimension number image.shape is 3 and the color channel number is 1 (i.e., image.shape[2] is 1), it is a grayscale image. Otherwise, it is not a grayscale image. If it is a grayscale image, the original image data, i.e., the image to be processed, is used. If it is not a grayscale image, a first grayscale image is extracted from the original image. For example, if the original image is an RGB image, the grayscale image of the R channel is extracted, which is processed by using the cv2 library of python. Specifically, the original image data is read by using the cv2.imread() function, and the R, G, and B channel data of the original image is separated by using the cv2.split() function. The R channel data, i.e., the R channel grayscale image (or the G channel grayscale image or the B channel grayscale image) is returned.
[0053] In the embodiment, which channel grayscale image, i.e., the target first color gamut image, is returned is determined by the correspondence between the remainder obtained by dividing the length of the original watermark data by a preset number and the first color gamut image. For example, assuming that the preset number is 3, the remainder obtained by dividing the length of the original watermark data by 3 is 0, the R channel grayscale image is returned; the remainder obtained by dividing the length of the original watermark data by 3 is 1, the G channel grayscale image is returned; and the remainder obtained by dividing the length of the original watermark data by 3 is 2, the B channel grayscale image is returned. Assuming that the preset number is 7, the remainder obtained by dividing the length of the original watermark data by 7 is 0, the R channel grayscale image is returned; the remainder obtained by dividing the length of the original watermark data by 7 is 1, the G channel grayscale image is returned; the remainder obtained by dividing the length of the original watermark data by 7 is 2, the B channel grayscale image is returned; the remainder obtained by dividing the length of the original watermark data by 7 is 3, the R channel grayscale image and the G channel grayscale image are returned; the remainder obtained by dividing the length of the original watermark data by 7 is 4, the R channel grayscale image and the B channel grayscale image are returned; the remainder obtained by dividing the length of the original watermark data by 7 is 5, the G channel grayscale image and the B channel grayscale image are returned; and the remainder obtained by dividing the length of the original watermark data by 7 is 6, the R channel grayscale image, the G channel grayscale image, and the B channel grayscale image are returned. It should be noted that the preset number is an example, and in actual application, the preset number and the correspondence between the remainder obtained by dividing the length of the original watermark data by the preset number and the first color gamut image can be set according to actual needs, which does not limit the function and use range of the embodiment.
[0054] In the embodiment, the first watermark data is replaced into the preset data position in any first color gamut image. Specifically, the first watermark data M is embedded into the preset data position, for example, the least significant bit, of the first gray image P by bit. The first gray image P is read and converted into a binary array Data; the first watermark data M is stored in an array converted from a byte array into a bit array; Data is traversed, the value of Data corresponding to the current loop index is read as byte data D, the value of M corresponding to the current loop index is read as bit data Q, if the index value is greater than the length of M, the reading of M starts from the first bit; the value of the least significant bit of the byte data D is modified as Q.
[0055] In the embodiment, the returned channel gray image, i.e., the target first color gamut image, is embedded with the first watermark data, and the first color gamut images are merged to obtain the target watermark image. If the original image, i.e., the image to be processed, is a gray image, the gray image embedded with the watermark is directly saved; if the original image is not a gray image, the first gray image P is merged to obtain the corresponding original image. For example, the original image is an RGB image, and the current gray image P is derived from the R channel gray image. The merging steps are as follows: the cv2.merge([B, G, R]) function is called to merge the original B and G channels and the modified R channel gray image P to obtain the RGB image embedded with the watermark, i.e., the target watermark image.
[0056] In step S240, at least part of the first watermark data and the target watermark image are sent to the server end, wherein the server end is configured to extract second watermark data from the target watermark image and verify the consistency of the watermark data according to the comparison result between at least part of the first watermark data and the second watermark data.
[0057] In the embodiment, at least part of the first watermark data (the first check data and / or the original watermark data) and the target watermark image are sent to the server end, so that the server end compares the first check data with the second check data and / or the original watermark data with the initial watermark data. If the first check data is the same as the second check data and / or the original watermark data is the same as the initial watermark data, it is determined that the watermark data is consistent, i.e., the first watermark data is consistent with the second watermark data, indicating that the target watermark image has no tampering and damage risk. It can be understood that the first check data and the original watermark data are the first watermark data.
[0058] In an embodiment of the present application, the first region image is extracted from the to-be-processed image according to a preset extraction rule, image recognition is performed on the first region image to obtain first image information, and the first image information is sent to a server end, wherein the server end is configured to extract a second region image from a target watermark image according to the preset extraction rule, perform image recognition on the second region image to obtain second image information, compare the first image information with the second image information, and verify the consistency of the to-be-processed image and the target watermark image according to a comparison result.
[0059] In the embodiment, the first image information and the second image information are obtained by performing image recognition on the partial images in the to-be-processed image and the partial images of the same part in the target watermark image respectively, the consistency of the target watermark image is verified again according to a comparison result of the first image information and the second image information, and the tampering and damage risk of the target watermark image is determined again.
[0060] In an embodiment of the present application, the image processing method based on digital watermarking is applied to a server end, and at least includes steps S310 to S320, which are described in detail as follows.
[0061] In step S310, at least part of first watermark data and a target watermark image are received, wherein the vehicle terminal is configured to acquire original watermark data and a to-be-processed image, generate first check data according to the original watermark data, generate the first watermark data according to the original watermark data and the first check data, split the to-be-processed image into a plurality of first color domain images according to a color domain channel, replace the first watermark data to a preset data position in any first color domain image, and perform channel merging on the first color domain images to obtain the target watermark image, and the at least part of the first watermark data and the target watermark image are sent to the server end.
[0062] In the embodiment, the specific manner in which the vehicle terminal determines the first watermark data and the target watermark image has been described in detail in the foregoing embodiments, and will not be described herein again.
[0063] In step S320, second watermark data is extracted from the target watermark image, and the consistency of the watermark data is verified according to a comparison result between the at least part of the first watermark data and the second watermark data.
[0064] In an embodiment of the present application, a second image dimension number of the target watermark image is obtained; if the target watermark image is determined to be a grayscale image according to the second image dimension number, second watermark data is extracted from the target watermark image; if the target watermark image is determined not to be a grayscale image according to the second image dimension number, the target watermark image is split into a plurality of second color domain images according to color domain channels, and second watermark data is extracted from a preset data position of a target second color domain image, wherein the target second color domain image is determined according to a correspondence relationship between a length of the original watermark data and a remainder of the preset number and the second color domain image.
[0065] In the embodiment, it is determined whether the target watermark image is a grayscale image, and if the target watermark image is a grayscale image, the second watermark data is directly extracted from the target watermark image; if the target watermark image is not a grayscale image, a second grayscale image is extracted from the target watermark image. For example, the original picture is an RGB picture, and a grayscale image of the RGB channel is extracted, and the processing is performed by using the python cv2 library, and the steps are as follows: the original picture data is read by using the cv2.imread() function; the R, G and B channel data of the original picture is separated by using the cv2.split() function; the target watermark image is split into a plurality of second color domain images according to color domain channels, and second watermark data is extracted from a preset data position of a target second color domain image, wherein the target second color domain image is determined according to a correspondence relationship between a length of the original watermark data and a remainder of the preset number and the second color domain image. For example, the R channel data, i.e. the R channel grayscale image (consistent with the extraction channel in the embedding process), is returned.
[0066] In an embodiment of the present application, a first watermark length of the first watermark data is calculated according to a length of the original watermark data and a length of the first check data; the first watermark length is compared with a second watermark length of the second watermark data, if the second watermark length is smaller than the first watermark length, an abnormality check information is generated to prompt the user; if the second watermark length is greater than or equal to the first watermark length, the consistency of the watermark data is verified according to a comparison result between at least part of the first watermark data and the second watermark data.
[0067] In the embodiment, the second gray scale map P2, i.e. the second color gamut map information, the pixel width width, the pixel height height, and the total byte length totalPixels of P2 are obtained by assuming that each pixel corresponds to one byte; all byte data of the second gray scale map P2 is traversed once according to totalPixels, and the least significant bit data of each byte is extracted and saved in bitList; bitList is traversed in turn, each group of 8 bits is converted into one byte data and saved in byteList, and the second watermark length is obtained according to the length of bitList; the expected byte length L, i.e. the first watermark length, is calculated: ORIGINAL_LENGTH (the length of the original watermark data T) + 4 (the length of the check code generated by the CRC-32 algorithm); if the length of bitList is less than L, it indicates that the original watermark data T and the second check code U, i.e. the second check data, are not obtained, and an exception result is thrown; if the length of bitList is greater than L, the next step is performed, i.e. the consistency of the watermark data is verified according to the comparison result between at least part of the first watermark data and the second watermark data.
[0068] In the embodiment, the second watermark data T' and the second check code crcData' are separated, and data of corresponding lengths are extracted from bitList according to the length of the original watermark data T and the length of the first check code crcData, to obtain the second watermark data T' and the corresponding CRC check code calculatedCRC, i.e. the second check code.
[0069] In an embodiment of the present application, at least part of the first watermark data is compared with the second watermark data to obtain a comparison result; if the comparison result is that at least part of the first watermark data is the same as the corresponding part of the second watermark data, it is determined that the watermark data is consistent; if the comparison result is that at least part of the first watermark data is not the same as the corresponding part of the second watermark data, it is determined that the watermark data is inconsistent.
[0070] In the embodiment, the calculated check code calculatedCRC, i.e. the second check code, and the received check code crcData, i.e. the first check code, are compared to verify the integrity of the data. The verification is performed by CRC (Cyclic Redundancy Check). If crcValid is True, i.e. if the second check code is equal to the first check code, the verification is passed, indicating that the picture transmission is correct and complete and has not been tampered with; if crcValid is false, i.e. if the second check code is not equal to the first check code, it indicates that the picture has been tampered with or there is a missing picture data during the picture transmission process, and the picture receiver, i.e. the server end, will perform corresponding business processing according to the verification result.
[0071] Figure 3is a schematic diagram of a digital watermark embedding process of the digital watermark-based image processing method shown in an exemplary embodiment of the present application. Referring to Figure 3 As shown, in an exemplary embodiment, first check data is generated from original watermark data using a cyclic redundancy check (CRC) algorithm, and first watermark data is generated from the original watermark data and the first check data; original image data, i.e. image data to be processed, is read, and it is determined whether the image to be processed is a grayscale image. If the image to be processed is a grayscale image, the grayscale image is directly read. If the image to be processed is not a grayscale image, a grayscale image is extracted from the image to be processed, and then the grayscale image is read. It is determined whether the space of the grayscale image is sufficient according to the total pixels of the grayscale image and the length of the first watermark data. If the space is not sufficient, an exception is thrown, i.e. an exception information is generated to prompt the user. If the space is sufficient, the first watermark data is embedded in the grayscale image to obtain a target watermark image, and the target watermark image is saved. If the image to be processed is a grayscale image, the target watermark image is directly saved. If the image to be processed is not a grayscale image, the grayscale image is restored, and then the image is saved. The specific implementation has been described in the foregoing embodiment, and thus will not be described here again.
[0072] Figure 4 is a schematic diagram of a digital watermark extraction and verification process of the digital watermark-based image processing method shown in an exemplary embodiment of the present application. Referring to Figure 4 As shown, in an exemplary embodiment, watermark image data, i.e. target watermark image data, is read, and it is determined whether the target watermark image is a grayscale image. If the target watermark image is a grayscale image, the grayscale image is directly read. If the target watermark image is not a grayscale image, a grayscale image is extracted from the target watermark image, and then the grayscale image is read. The least significant bit data in the grayscale image is extracted, and second check data is obtained by separating the extracted least significant bit data. The first check data and the second check data are compared, and the consistency of the watermark data is verified according to the comparison result. The specific implementation has been described in the foregoing embodiment, and thus will not be described here again.
[0073] The application combines the CRC algorithm with the LSB algorithm, improves the checking efficiency and speed, and ensures the integrity and reliability of the data. The application obtains original watermark data and an image to be processed, generates first checking data according to the original watermark data, generates first watermark data according to the original watermark data and the first checking data, splits the image to be processed into a plurality of first gamut images according to a gamut channel, replaces the first watermark data to a preset data position in any first gamut image, and performs channel merging on the first gamut images to obtain a target watermark image. At least part of the first watermark data and the target watermark image are sent to a server end, wherein the server end is used for extracting second watermark data from the target watermark image, and verifying the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data. The application has the following advantages: 1. improving data security: the CRC-32 check code is embedded in the least significant bit of the image data to realize implicit checking of the image data, effectively preventing tampering and damage of the data in the transmission or storage process. 2. reducing resource requirements: compared with the transform domain method and the zero watermark technology, the method of the application saves storage space and reduces the requirements on the equipment. 3. improving checking efficiency: the CRC-32 algorithm has high calculation speed and can realize fast checking without affecting the image quality.
[0074] Figure 5 is a block diagram of an exemplary embodiment of the application, which is a digital watermark-based image processing system. The device can be applied to the implementation environment shown in Figure 1 and is specifically configured in the computer device 102. The device can also be applied to other exemplary implementation environments and is specifically configured in other devices, and the implementation environment to which the device is applied is not limited in the embodiment.
[0075] As shown in Figure 5 , the exemplary digital watermark-based image processing system includes a vehicle terminal 510 and a server end 520.
[0076] The vehicle terminal 510 is configured to obtain original watermark data and an image to be processed, generate first checking data according to the original watermark data, generate first watermark data according to the original watermark data and the first checking data, split the image to be processed into a plurality of first gamut images according to a gamut channel, replace the first watermark data to a preset data position in any first gamut image, and perform channel merging on the first gamut images to obtain a target watermark image. At least part of the first watermark data and the target watermark image are sent to the server end. The server end 520 is configured to extract second watermark data from the target watermark image, and verify the consistency of the watermark data according to a comparison result between at least part of the first watermark data and the second watermark data.
[0077] It should be noted that the digital watermark-based image processing system provided by the above-mentioned embodiments and the digital watermark-based image processing method provided by the above-mentioned embodiments belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiments, which will not be repeated here. The digital watermark-based image processing system provided by the above-mentioned embodiments can allocate the above functions to different functional modules to be completed according to actual application needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above, and this is not limited herein.
[0078] Embodiments of the present application also provide an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the digital watermark-based image processing method provided in each of the above-mentioned embodiments. The above-mentioned electronic device includes a vehicle terminal.
[0079] Figure 6 The structure of the computer system of the electronic device suitable for implementing the embodiments of the present application is shown. It should be noted that, Figure 6 The computer system 600 of the electronic device shown is only an example and should not limit the functions and use range of the embodiments of the present application.
[0080] As Figure 6 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or programs loaded from a storage portion 608 to a random access memory (RAM) 603, such as performing the method provided by each of the above-mentioned embodiments. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0081] The following components are connected to the I / O interface 605: an input part 606 including a keyboard, a mouse, etc.; an output part 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), etc., and a speaker, etc.; a storage part 608 including a hard disk, etc.; and a communication part 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as necessary. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 610 as necessary, so that a computer program read out therefrom is installed in the storage part 608 as necessary.
[0082] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing a computer program for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, various functions defined in the system of the present application are executed.
[0083] It should be noted that the computer-readable medium in the embodiments shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable signal medium can include a data signal propagating in a baseband or as a carrier wave in a propagated data signal, in which the computer-readable computer program is carried. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit programs for use by or in connection with an instruction execution system, device or component. The computer program contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, or the like, or any suitable combination of the above.
[0084] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In the flowcharts or block diagrams, each block can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks represented in succession can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0085] The units described in the embodiments of the present application can be implemented in the form of software, or can be implemented in the form of hardware, and the described units can also be arranged in a processor. In some cases, the names of these units do not constitute a limitation on the units themselves.
[0086] Another aspect of the present application also provides a computer readable storage medium having stored thereon a computer program, which, when executed by a processor of a computer, causes the computer to perform the image processing method based on digital watermarking provided in each of the above embodiments. The computer readable storage medium can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device.
[0087] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0088] Another aspect of the present application also provides a computer program product or computer program, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the image processing method based on digital watermarking provided in each of the above embodiments.
[0089] From the above description of the embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.) or a network, and includes a number of instructions to make a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) execute the methods according to the embodiments of the present application.
[0090] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the application following the general principles thereof and including such departures from the present disclosure as come within known use or custom in the art.
[0091] The above embodiments are only illustrative of the principles of the present application and its effects, and are not intended to limit the present application. Any modification or change made by any person skilled in the art without departing from the spirit and scope of the present application shall be covered by the claims of the present application.
Claims
1. An image processing method based on digital watermarking, characterized in that, Applied to a vehicle terminal, the method includes: Obtain the original watermark data and the image to be processed; First verification data is generated based on the original watermark data, and first watermark data is generated based on the original watermark data and the first verification data; The image to be processed is divided into multiple first color gamut maps according to the color gamut channels. The first watermark data is replaced to a preset data position in any first color gamut map. The channels of each first color gamut map are merged to obtain the target watermark map. The preset data position includes the least significant bit. At least a portion of the first watermark data and the target watermark image are sent to the server, wherein the server is used to extract the second watermark data from the target watermark image and verify the consistency of the watermark data based on the comparison result between at least a portion of the first watermark data and the second watermark data. According to a preset extraction rule, a first region image is extracted from the image to be processed, and image recognition is performed on the first region image to obtain first image information; The first image information is sent to the server, wherein the server is used to extract a second region image from the target watermark image according to the preset extraction rules, perform image recognition on the second region image to obtain second image information, compare the first image information with the second image information, and verify the consistency between the image to be processed and the target watermark image based on the comparison result; The image to be processed is divided into multiple first color gamut maps according to the color gamut channels, and the first watermark data is replaced to a preset data position in any of the first color gamut maps, including: If the image to be processed is determined to be not a grayscale image based on the first image dimension number, then the image to be processed is split into multiple first color gamut images according to the color gamut channels. The remainder is calculated based on the length of the original watermark data and a preset number. The target first color gamut image is determined based on the correspondence between the remainder and the first color gamut image. The first watermark data is then replaced in the preset data position in the target first color gamut image.
2. The image processing method based on digital watermarking according to claim 1, characterized in that, Before obtaining the original watermark data, the method further includes: Acquire the timestamp of the image to be processed, the vehicle information corresponding to the vehicle terminal, and the user information; The original watermark data is determined based on at least one of the timestamp, the vehicle information, and the user information.
3. The image processing method based on digital watermarking according to claim 1, characterized in that, After generating the first watermark data based on the original watermark data and the first verification data, the method further includes: Obtain the first total number of pixels of the image to be processed, and calculate the first data length required by the first total number of pixels; Compare the first data length with the second data length corresponding to the first watermark data; If the length of the first data is greater than or equal to the length of the second data, the image to be processed is split into multiple first color gamut maps according to the color gamut channels; If the first data length is less than the second data length, then the image processing of the image to be processed ends.
4. The image processing method based on digital watermarking according to any one of claims 1 to 3, characterized in that, The image to be processed is divided into multiple first color gamut maps according to the color gamut channels, and the first watermark data is replaced to a preset data position in any of the first color gamut maps, including: Obtain the first image dimension of the image to be processed; If the image to be processed is determined to be a grayscale image based on the first image dimension, then the first watermark data is replaced with a preset data position in any first color gamut image.
5. An image processing method based on digital watermarking, characterized in that, Applied to the server side, the method includes: The system receives at least a portion of first watermark data and a target watermark image sent by a vehicle terminal. The vehicle terminal is configured to acquire original watermark data and an image to be processed, generate first verification data based on the original watermark data, generate the first watermark data based on the original watermark data and the first verification data, split the image to be processed into multiple first color gamut images according to color gamut channels, replace the first watermark data with a preset data position in any first color gamut image, and merge the channels of each first color gamut image to obtain the target watermark image. The preset data position includes the least significant bit. The system then sends at least a portion of the first watermark data and the target watermark image to a server. Extracting second watermark data from the target watermark image and verifying the consistency of the watermark data based on the comparison results between at least a portion of the first watermark data and the second watermark data; extracting second watermark data from the target watermark image includes: if the target watermark image is determined not to be a grayscale image based on the second image dimension number of the target watermark image, then splitting the target watermark image into multiple second color gamut images according to the color gamut channels, and extracting the second watermark data at a preset data position in the target second color gamut image, wherein the target second color gamut image is determined based on the correspondence between the length of the original watermark data and the remainder of a preset number and the second color gamut image; The vehicle terminal receives first image information sent by the vehicle terminal, extracts a second region image from the target watermark image according to a preset extraction rule, performs image recognition on the second region image to obtain second image information, compares the first image information with the second image information, and verifies the consistency between the image to be processed and the target watermark image based on the comparison result. The vehicle terminal is used to extract a first region image from the image to be processed according to the preset extraction rule, and perform image recognition on the first region image to obtain first image information.
6. The image processing method based on digital watermarking according to claim 5, characterized in that, Extracting the second watermark data from the target watermark image includes: Obtain the second image dimension of the target watermark image; If the target watermark image is determined to be a grayscale image based on the second image dimension, then the second watermark data is extracted from the target watermark image.
7. The image processing method based on digital watermarking according to claim 5, characterized in that, After extracting the second watermark data from the target watermark image, the method further includes: The first watermark length of the first watermark data is calculated based on the length of the original watermark data and the length of the first verification data. The length of the first watermark is compared with the length of the second watermark data. If the length of the second watermark is less than the length of the first watermark, an error message is generated to prompt the user. If the length of the second watermark is greater than or equal to the length of the first watermark, the consistency of the watermark data is verified based on the comparison result between at least a portion of the first watermark data and the second watermark data.
8. The image processing method based on digital watermarking according to any one of claims 5 to 7, characterized in that, The consistency of the watermark data is verified based on a comparison between at least a portion of the first watermark data and the second watermark data, including: Compare at least a portion of the first watermark data with the second watermark data to obtain a comparison result; If the comparison result shows that at least a portion of the first watermark data is the same as the corresponding portion of the second watermark data, then the watermark data are determined to be consistent. If the comparison result shows that at least a portion of the first watermark data is different from the corresponding portion of the second watermark data, then the watermark data are determined to be inconsistent.
9. An image processing system based on digital watermarking, characterized in that, include: The vehicle terminal is used to acquire the original watermark data and the image to be processed, generate first verification data based on the original watermark data, generate first watermark data based on the original watermark data and the first verification data, split the image to be processed into multiple first color gamut images according to the color gamut channels, replace the first watermark data with a preset data position in any first color gamut image, and merge the channels of each first color gamut image to obtain a target watermark image. The preset data position includes the least significant bit. At least a portion of the first watermark data and the target watermark image are sent to the server. According to a preset extraction rule, a first region image is extracted from the image to be processed, and image recognition is performed on the first region image to obtain first image information; Send the first image information to the server. The process involves splitting the image to be processed into multiple first color gamut images according to the color gamut channels, and replacing the first watermark data with a preset data position in any first color gamut image. This includes: if the image to be processed is determined not to be a grayscale image based on the first image dimension number of the image to be processed, then splitting the image to be processed into multiple first color gamut images according to the color gamut channels, calculating the remainder based on the length of the original watermark data and a preset number, determining the target first color gamut image based on the correspondence between the remainder and the first color gamut image, and replacing the first watermark data with a preset data position in the target first color gamut image. On the server side, it is used to extract second watermark data from the target watermark image, and verify the consistency of the watermark data based on the comparison result between at least a portion of the first watermark data and the second watermark data; extract a second region image from the target watermark image according to the preset extraction rules, perform image recognition on the second region image to obtain second image information, compare the first image information with the second image information, and verify the consistency between the image to be processed and the target watermark image based on the comparison result.
Citation Information
Patent Citations
Digital watermark embedding method, extraction method, device and digital watermark system
CN108665403A
Image watermark processing method and device, equipment and storage medium
CN115481374A