A watermark superimposing and restoring method and device
By identifying the pixel features of the image to calculate the target index value and determining the watermark overlay position, the problem of complex calculation of watermark overlay position is solved and the watermark overlay efficiency is improved.
Patent Information
- Application Number
- CN202210744476.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-27
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2042-06-27
AI Technical Summary
In the prior art, the calculation of watermark superposition position is complex and inefficient.
By identifying the characteristics of the image pixel points, the target index value is calculated, and the target superposition position is determined based on the corresponding relationship between the preset index value and the superposition position, and the watermark information is modified.
It realizes rapid determination of the watermark overlay position and improves the calculation efficiency during the watermark overlay process.
Smart Images

Figure CN115063280B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information technology, and particularly to a method and device for watermark overlay and restoration. Background Art
[0002] Currently, the application of overlaying watermarks in images or videos has become increasingly widespread. For example, information such as website addresses and companies can be added to images or videos by overlaying watermarks, thereby preventing others from using them without permission.
[0003] Then, the inventors found through research that currently, when determining the overlay position of a watermark, it is generally calculated through the SIFT (Scale-invariant feature transform) algorithm, and the calculation through this algorithm is often relatively complex. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide a method and device for watermark overlay and restoration, so as to solve the problem of complex calculation of the watermark overlay position during the watermark overlay process. The specific technical solutions are as follows:
[0005] In the first aspect of the embodiments of this application, first, a watermark overlay method is provided, including:
[0006] Identifying the pixel features of each pixel point in the image to be processed;
[0007] Calculating a target index value according to the identified pixel features of each pixel point;
[0008] Determining the target overlay position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and overlay position;
[0009] Modifying the pixels at the target overlay position according to the watermark information to be overlaid to obtain the overlaid image.
[0010] Optionally, the calculating a target index value according to the identified pixel features of each pixel point includes:
[0011] Creating a feature matrix according to the identified pixel values of each pixel point;
[0012] Scaling the feature matrix to generate a target matrix of a preset specification;
[0013] Reducing the dimension of the target matrix to obtain the target index value.
[0014] Optionally, before modifying the pixels at the target overlay position according to the watermark information to be overlaid to obtain the overlaid image, the method further includes:
[0015] Encode the watermark information to be superimposed;
[0016] Modifying the pixels at the target superimposition position according to the watermark information to be superimposed to obtain a superimposed image, including:
[0017] Modify the pixels at the target superimposition position according to the watermark information obtained after encoding to obtain a superimposed image.
[0018] Optionally, modifying the pixels at the target superimposition position according to the watermark information to be superimposed to obtain a superimposed image, including:
[0019] Select the pixels at the specified positions in the area to be superimposed;
[0020] Perform compression transformation on the pixels at the specified positions through a preset compression algorithm to obtain transformed pixel values;
[0021] Select the pixel features of each pixel at the corresponding position of the watermark according to the watermark information to be superimposed;
[0022] Judge whether the transformed pixel values need to be modified according to the pixel features of each pixel through a preset rule;
[0023] If modification is required, modify the brightness of the pixels to be modified to obtain a superimposed image.
[0024] Optionally, judging whether the transformed pixel values need to be modified according to the pixel features of each pixel through a preset rule, including:
[0025] For any pixel, select the first pixel at the first adjacent position and the second pixel at the second adjacent position of the pixel;
[0026] Calculate the ratio of the difference between the first pixel and the second pixel to the pre-obtained image quality feature value, where the image quality feature value is a feature parameter representing the image quality;
[0027] If the ratio is greater than the preset watermark strength, it is determined that modification is required, otherwise it is determined that modification is not required.
[0028] In the second aspect of the embodiments of the present application, a watermark recovery method is provided, including:
[0029] Identify the pixel features of each pixel point in the target image;
[0030] Calculate a target index value according to the identified pixel features of each pixel point;
[0031] Determine the target watermark position corresponding to the target index value according to the pre-determined correspondence between the index value and the watermark position.
[0032] Extract the pixels at the specified position according to the target watermark position.
[0033] Identify the watermark information of the target watermark according to the pixels at the specified position.
[0034] Optionally, the identifying the pixel features of each pixel point in the target image includes:
[0035] Obtain the image to be restored.
[0036] Perform correction on the image to be corrected through perspective transformation to obtain the target image.
[0037] Optionally, the watermark information includes multiple watermark data, and the identifying the watermark information of the target watermark according to the pixels at the specified position includes:
[0038] Identify multiple watermark data to be determined according to the pixels at the specified position;
[0039] For any watermark data to be determined, calculate the similarity between the watermark to be determined and the preset watermark;
[0040] Select the watermark data corresponding to the similarity greater than the preset threshold among the multiple watermark data to be determined to obtain the watermark information to be determined;
[0041] Calculate the watermark information of the target watermark according to the watermark information to be determined through a preset algorithm.
[0042] In the third aspect of the embodiments of the present application, a watermark superimposing device is provided, including:
[0043] A feature recognition module, configured to recognize the pixel features of each pixel point in the image to be processed;
[0044] An index value calculation module, configured to calculate a target index value according to the recognized pixel features of each pixel point;
[0045] A position determination module, configured to determine the target superimposing position corresponding to the target index value according to the correspondence between the target index value and the pre-determined index value and the superimposing position;
[0046] An image generation module, configured to modify the pixels at the target superimposing position according to the watermark information to be superimposed to obtain the superimposed image.
[0047] Optionally, the index value calculation module includes:
[0048] A matrix creation sub-module, configured to create a feature matrix according to the pixel values of the recognized pixel points;
[0049] A matrix scaling sub-module, configured to scale the feature matrix to generate a target matrix with a preset specification;
[0050] A matrix dimensionality reduction sub-module, configured to reduce the dimensionality of the target matrix to obtain the target index value.
[0051] Optionally, the device further includes:
[0052] An information encoding module, configured to encode the watermark information to be superimposed;
[0053] The image generation module is specifically configured to modify the pixels at the target superimposition position according to the watermark information obtained after encoding, to obtain the superimposed image.
[0054] Optionally, the image generation module includes:
[0055] A pixel selection sub-module, configured to select the pixels at the specified positions in the area to be superimposed;
[0056] A pixel compression sub-module, configured to perform a compression transformation on the pixels at the specified positions through a preset compression algorithm to obtain the transformed pixel values;
[0057] A feature selection sub-module, configured to select the pixel features of the pixels at the corresponding positions of the watermark according to the watermark information to be superimposed;
[0058] A modification judgment sub-module, configured to judge whether the transformed pixel values need to be modified according to the pixel features of the pixels through a preset rule;
[0059] A brightness modification sub-module, configured to modify the brightness of the pixels to be modified if modification is required, to obtain the superimposed image.
[0060] Optionally, the modification judgment sub-module includes:
[0061] A pixel selection unit, configured to, for any pixel, select a first pixel at a first adjacent position and a second pixel at a second adjacent position of the pixel;
[0062] A ratio calculation unit, configured to calculate the ratio of the difference between the first pixel and the second pixel to a pre-acquired image quality feature value, where the image quality feature value is a feature parameter representing the image quality;
[0063] A modification determination unit, configured to determine that modification is required if the ratio is greater than a preset watermark strength, otherwise determine that modification is not required.
[0064] In a fourth aspect of the embodiments of the present application, a watermark recovery device is provided, including:
[0065] An image recognition module, configured to recognize pixel features of each pixel point in a target image;
[0066] A feature calculation module, configured to calculate a target index value according to the recognized pixel features of each pixel point;
[0067] A watermark determination module, configured to determine a target watermark position corresponding to the target index value according to a correspondence between the target index value and pre-determined index values and watermark positions;
[0068] A pixel extraction module, configured to extract pixels at a specified position according to the target watermark position;
[0069] An information recognition module, configured to recognize watermark information of a target watermark according to the pixels at the specified position.
[0070] Optionally, the image recognition module includes:
[0071] An image acquisition sub-module, configured to acquire an image to be recovered;
[0072] An image correction sub-module, configured to correct the image to be corrected through perspective transformation to obtain the target image.
[0073] Optionally, the watermark information includes multiple pieces of watermark data, and the information recognition module includes:
[0074] A data determination sub-module, configured to recognize multiple pieces of watermark data to be determined according to the pixels at the specified position;
[0075] A similarity calculation sub-module, configured to calculate a similarity between any piece of watermark data to be determined and a preset watermark;
[0076] A data determination sub-module, configured to select watermark data corresponding to similarities greater than a preset threshold among multiple pieces of watermark data to be determined to obtain watermark information to be determined;
[0077] A watermark calculation sub-module, configured to calculate the watermark information of the target watermark through a preset algorithm according to the watermark information to be determined.
[0078] In another aspect of the embodiments of the present application, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0079] The memory is used for storing a computer program;
[0080] A processor, when executing a program stored in a memory, implements any of the above watermark superimposing methods.
[0081] On the other hand, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus;
[0082] The memory is used to store a computer program;
[0083] A processor, when executing a program stored in a memory, implements any of the above watermark recovery methods.
[0084] On the other hand, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the above watermark superimposing methods.
[0085] On the other hand, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the above watermark recovery methods.
[0086] Beneficial effects of the embodiments of the present application:
[0087] A watermark superimposing and recovering method and device provided by an embodiment of the present application can identify the pixel features of each pixel point in an image to be processed; calculate a target index value according to the identified pixel features of each pixel point; determine a target superimposing position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and superimposing position; modify the pixels at the target superimposing position according to the watermark information to be superimposed to obtain a superimposed image. By presetting the corresponding relationship between the index value and the superimposing position first, and then calculating the target index value according to the pixel features of each pixel point in the image to be processed, so as to determine the target superimposing position corresponding to the target index value and perform watermark superimposing, it is possible to quickly determine the watermark superimposing position, thereby improving the efficiency of calculating the watermark superimposing position during the watermark superimposing process and solving the problem of complex calculation of the watermark superimposing position during the watermark superimposing process.
[0088] Of course, when implementing any product or method of the present application, it is not necessarily required to achieve all the above advantages at the same time. Description of the Drawings
[0089] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other embodiments based on these drawings.
[0090] Figure 1 It is a schematic flowchart of a watermark overlay method provided by an embodiment of the present application;
[0091] Figure 2 It is a schematic flowchart of a process for calculating a target index value provided by an embodiment of the present application;
[0092] Figure 3 It is a schematic flowchart of a process for obtaining an overlaid image provided by an embodiment of the present application;
[0093] Figure 4 It is a schematic flowchart of a watermark data recovery method provided by an embodiment of the present application;
[0094] Figure 5 It is a schematic flowchart of a process for identifying pixel features of each pixel point in a target image to be provided by an embodiment of the present application;
[0095] Figure 6 It is a schematic flowchart of a process for identifying watermark information of a target watermark provided by an embodiment of the present application;
[0096] Figure 7 It is a schematic structural diagram of a watermark overlay device provided by an embodiment of the present application;
[0097] Figure 8 It is a schematic structural diagram of a watermark data recovery device provided by an embodiment of the present application;
[0098] Figure 9 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0099] Figure 10 It is another schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0100] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present application.
[0101] First, the professional terms that may be used in the embodiments of the present application are explained:
[0102] Invisible watermark: Embedding a specific digital signal into a digital product to generate watermark information that is not easily perceptible to the human eye;
[0103] YUV: YUV is a color encoding system mainly used in video and graphics processing pipelines;
[0104] Grayscale: Representing an object using black tones, i.e., using black as the reference color and different saturations of black to display an image;
[0105] Format conversion: Refers to the conversion of multimedia data encapsulation formats or audio - video data encoding formats;
[0106] Perspective transformation: Using the condition that the perspective center, image point, and target point are collinear, and rotating the projection plane (perspective plane) around the trace line (perspective axis) by a certain angle according to the perspective rotation law to destroy the original projection light beam while still maintaining the projection geometric figure on the projection plane unchanged;
[0107] DCT transform: A transform related to the Fourier transform, similar to the Discrete Fourier Transform (DFT), but only using real numbers;
[0108] BCH code: BCH code is an important class of error - correcting codes. The information sequence to be sent by the information source is divided into message groups in fixed κ - bit groups, and then each message group is independently transformed into a binary digital group of length n (n > κ), which is called a codeword;
[0109] Pixel mean value: The pixel mean value of a specified area of the picture;
[0110] Superposition position template: A series of watermark superposition position sequences.
[0111] In the first aspect of the embodiments of the present application, first, a watermark superposition method is provided, including:
[0112] Identifying the pixel features of each pixel point in the image to be processed;
[0113] Calculating a target index value according to the identified pixel features of each pixel point;
[0114] Determining the target superposition position corresponding to the target index value according to the corresponding relationship between the target index value and the pre - determined index value and superposition position;
[0115] Modifying the pixels at the target superposition position according to the watermark information to be superimposed to obtain the superimposed image.
[0116] It can be seen that through the method of the embodiments of the present application, the corresponding relationship between the preset index value and the superimposition position can be set first, and then the target index value can be calculated according to the pixel characteristics of each pixel point in the image to be processed, so as to determine the target superimposition position corresponding to the target index value and perform the superimposition of the watermark, which can realize the rapid determination of the watermark superimposition position, thereby improving the efficiency of calculating the watermark superimposition position during the watermark superimposition process and solving the problem of complex calculation of the watermark superimposition position during the watermark superimposition process.
[0117] Specifically, refer to Figure 1 , Figure 1 which is a schematic flowchart of a watermark superimposition method provided by an embodiment of the present application, including:
[0118] Step S11, identifying the pixel characteristics of each pixel point in the image to be processed.
[0119] The image to be processed in the embodiments of the present application can be a single image or a video frame in a video. For example, when superimposing a watermark on a certain video, a video frame in the video can be extracted, and then the extracted video frame can be used as the image to be processed for watermark superimposition, so as to realize watermark superimposition on the video. The above pixel characteristics can be the grayscale, brightness, contrast, etc. of the pixel point. Preferably, in the embodiments of the present application, the YUV characteristics of the pixel point are identified, and the Y value in the identified YUV characteristics, that is, the brightness, is used as the pixel characteristic.
[0120] The method of the embodiments of the present application is applied to an intelligent terminal and can be implemented through the intelligent terminal. Specifically, the intelligent terminal can be a computer, a mobile phone, a server, etc. Among them, the intelligent terminal can be a device independent of the acquisition device. For example, the image collected by the camera is imported into the intelligent terminal, and the watermark is superimposed through the intelligent terminal. It can also be a device physically the same as the acquisition device. For example, the image is collected through the image acquisition unit of the intelligent terminal, and then the collected image is imported into the image processing unit of the intelligent terminal, and the watermark is superimposed through the image processing unit.
[0121] Step S12, calculating a target index value according to the pixel characteristics of each pixel point identified.
[0122] In the embodiments of the present application, after obtaining the pixel characteristics of each pixel point, a feature matrix can be generated through the pixel characteristic values of each pixel point, and then the matrix is dimension-reduced to generate a feature vector. Finally, the target index value is calculated according to the feature vector. Among them, when calculating the target index value according to the feature vector, the feature vector can be arranged in order to obtain a certain value, and finally the calculated value is used as the target index value, or the value is calculated to generate the target index value. Specifically, reference can be made to the subsequent embodiments.
[0123] Step S13: Determine the target superposition position corresponding to the target index value according to the pre-determined correspondence between the index value and the superposition position.
[0124] In the embodiments of the present application, a superposition position can be set in advance for one or more index values. Thus, after determining the target index value, it can be matched according to the correspondence between the target index value to obtain the target superposition position corresponding to this index value. Specifically, the target superposition position can be a certain coordinate position in the image to be processed.
[0125] Step S14: Modify the pixels at the target superposition position according to the watermark information to be superimposed to obtain the superimposed image.
[0126] Among them, the watermark in the embodiments of the present application may refer to an invisible watermark, and the watermark information to be superimposed may be information such as a website address, company name, etc. Specifically, in actual use, when superimposing the watermark according to the watermark information, the watermark information is often encoded, and then the watermark is superimposed through the encoded information. For example, binary error correction code encoding can be performed according to the watermark information, and then the superimposition of the watermark is performed through the encoded error correction code.
[0127] Among them, according to the watermark information to be superimposed, modifying the pixels at the target superposition position can determine the area to be superimposed according to the target superposition position, and modify the DCT coefficients of the pixels at the specified positions in the area to be superimposed, so as to achieve the superimposition of the watermark. Specifically, modifying the pixels can be adjusted according to the brightness value of the pixel, watermark strength, q value (image quality), etc. Specifically, the brightness of the pixel can be adjusted according to the corresponding relationship between the brightness value of the pixel, watermark strength, q value (image quality), etc., so as to achieve the superimposition of the watermark. Among them, the q value is a characteristic parameter used to describe the quality of the image frame, and its value range is between 1 - 31. The smaller the q value, the better the image quality and the larger the bit rate.
[0128] It can be seen that through the method of the embodiments of the present application, the correspondence between the index value and the superposition position can be preset first, and then the target index value is calculated according to the pixel characteristics of each pixel point in the image to be processed, so as to determine the target superposition position corresponding to the target index value and perform the superimposition of the watermark, which can realize the rapid determination of the watermark superimposition position, thereby improving the efficiency of calculating the watermark superimposition position during the watermark superimposition process and solving the problem of complex calculation of the watermark superimposition position during the watermark superimposition process.
[0129] Optionally, referring to Figure 2 , step S12 calculates the target index value according to the pixel characteristics of each recognized pixel point, including:
[0130] Step S121: Create a feature matrix based on the pixel values of the recognized pixel points.
[0131] Step S122: Scale the feature matrix to generate a target matrix of a preset specification.
[0132] Step S123: Reduce the dimension of the target matrix to obtain a target index value.
[0133] Create a feature matrix based on the pixel values of the recognized pixel points. A feature matrix can be created according to the brightness of the recognized pixel points. Specifically, each value in the generated matrix corresponds to the brightness value of a pixel. When the pixel value is brightness, the corresponding value will be a value between 0 and 255.
[0134] Among them, scale the feature matrix to generate a target matrix of a preset specification. It can be scaled by various methods. For example, it can be scaled by bilinear interpolation to obtain a target matrix of a preset rule. The above preset specification can be a preset matrix specification. For example, when the preset specification is a matrix of 8*8 size, by scaling the feature matrix, a matrix of 8*8 size can be obtained.
[0135] In the actual use process, the values of the target matrix may also be binarized. For example, by calculating the mean value of each value in the target matrix, and then comparing each value with the mean value. If it is less than the mean value, the value is modified to 0. If it is greater than the mean value, the value is modified to 1, thereby generating a binarized target matrix. By binarizing the target matrix to obtain a binarized target matrix, not only can pixel features be obtained, but also the computational complexity in the subsequent calculation process can be reduced, thereby improving the computational efficiency.
[0136] Reduce the dimension of the target matrix to obtain an index vector. It can be reduced in dimension by various dimensionality reduction methods. Specifically, the values of each row or each column of the target matrix can be summed. If it is greater than a certain preset value, the first value is taken. If it is less than a certain value, the second value is taken. For example, after summing each row of the binarized target matrix, if it is greater than 4, 1 is taken. If it is less than 4, 0 is taken, thereby obtaining an index vector composed of 8 values.
[0137] Calculate the target index value according to the index vector. The target index value can be calculated by various methods according to the values in the index vector. Specifically, the values in the index vector can be sorted to obtain the target index value, or calculated according to the sorted values to obtain the target index value. For example, when the index vector is (1, 0, 1, 0, 0, 1, 1, 0), the index value can be the value represented by the binary 10100110.
[0138] It can be seen that through the method of the embodiments of the present application, a feature matrix can be created according to the pixel features of each recognized pixel point, the feature matrix can be scaled, a target matrix with a preset specification can be generated, the target matrix can be dimensionally reduced to obtain an index vector, and a target index value can be calculated according to the index vector, so as to obtain an index value for representing the pixel features.
[0139] Optionally, referring to Figure 3 , step S14 modifies the pixels at the target superimposition position according to the watermark information to be superimposed to obtain the superimposed image, including:
[0140] Step S141, selecting the pixels at the specified position in the area to be superimposed;
[0141] Step S142, performing a compression transformation on the pixels at the specified position through a preset compression algorithm to obtain the transformed pixel values;
[0142] Step S143, selecting the pixel features of each pixel at the corresponding position of the watermark according to the watermark information to be superimposed;
[0143] Step S144, judging whether the transformed pixel values need to be modified according to the pixel features of each pixel through a preset rule;
[0144] Step S145, if modification is required, modifying the brightness of the pixels to be modified to obtain the superimposed image.
[0145] Specifically, selecting the pixels at the specified position in the area to be superimposed and performing a compression transformation on the pixels at the specified position through a preset compression algorithm can perform a discrete cosine transform (DCT) on the pixels at the specified position to obtain the transformed pixel values. For example, the pixels at the center position of the area to be superimposed can be selected. The applicant's research finds that when the pixels at the center position are selected, the generated watermark effect is often better and the loss rate of the watermark is low. According to the watermark information to be superimposed, the pixel features of each pixel at the corresponding position of the watermark can be selected. The bit values of each pixel at the same position in the corresponding image of the watermark can be selected according to the watermark information to be superimposed. For example, when the selected area is 8*8 pixels, after DCT transformation, then V43 and V34, that is, the pixels in the 3rd column of the 4th row and the 4th column of the 3rd row are selected as the specified pixels. According to the encoded watermark information, the corresponding bit values are selected. Specifically, the bit values can be 0 or 1. According to the corresponding bit values, it is judged whether the transformed pixel values need to be modified. In the actual use process, when the watermark information is a binary error correction code, the corresponding encoding rules can be selected for each digit respectively.
[0146] Optionally, according to the pixel characteristics of each pixel, it is determined whether the pixel values after transformation need to be modified through a preset rule, including: for any pixel, selecting the first pixel at the first adjacent position of the pixel and the second pixel at the second adjacent position; calculating the ratio of the difference between the first pixel and the second pixel to the image quality characteristic value obtained in advance, where the image quality characteristic value is a characteristic parameter representing the image quality; if the ratio is greater than the preset watermark strength, it is determined that modification is required, otherwise it is determined that modification is not required.
[0147] For any pixel, select the first pixel at the first adjacent position of the pixel and the second pixel at the second adjacent position. The bit values of the first pixel at the first adjacent position of the pixel and the second pixel at the second adjacent position can be selected, and then through a preset rule, calculate the ratio of the difference between the first pixel and the second pixel to the image quality characteristic value obtained in advance, and determine whether the pixel at the specified position needs to be modified according to the calculated ratio. For example, when the selected area is 8*8 pixels, when the bit value of the binary error correction code is 0, it is required that (V34 - V43) / q > s; when the bit value is 1, it is required that (V43 - V34) / q > s. Where s is the watermark strength, and the higher the watermark strength, the better the recognition effect after taking a photo. This value can be a value set by the user, q is the q value, and the q value corresponds to the quantization step of jpeg compression, representing the image quality. V43 and V34 respectively represent the image. When the above rules are not met, modification is performed, and if they are met, modification can be not performed. Specifically, when the bit value is 0, the values of V34 and V43 are modified. The modified value of V'34 is s*q + (V43 + V34) / 2, and the value of V'43 is (V43 + V34) / 2 - s*q; when the bit value is 1, the modified value of V'43 is s*q + (V43 + V34) / 2, and the value of V'34 is (V43 + V34) / 2 - s*q.
[0148] Among them, when modifying the brightness of the pixels to be modified in the area to be superimposed, since the superimposed area consists of multiple 8*8 blocks, BCH(63, 39) requires 63bit data, and each bit corresponds to an 8*8 block, so 63 areas, that is, 63 8*8 blocks, need to be superimposed. A square area with a length of 8*8 and a width of 8*8 represents a watermark. Through the superimposition of one or more watermarks, the superimposed image is obtained.
[0149] Optionally, before obtaining the superimposed image by modifying the pixels at the target superimposed position according to the watermark information to be superimposed, the above method further includes: encoding the watermark information to be superimposed; modifying the pixels at the target superimposed position according to the watermark information to be superimposed to obtain the superimposed image, including: modifying the pixels at the target superimposed position according to the encoded watermark information to obtain the superimposed image.
[0150] Among them, the watermark information to be superimposed is encoded to obtain the encoded watermark information. Binary error correction code encoding can be performed on the watermark information to be superimposed. For example, BCH error correction code encoding method is used for binary error correction code encoding. The encoding length can be selected according to the length of the valid data sent by the user. For example, bch(63, 39) encoding is used, with a total data length of 63 bits and a valid data length of 39 bits.
[0151] It can be seen that through the method of the embodiment of the present application, pixels at specified positions in the area to be superimposed can be selected, compressed transformation is performed on the pixels at the specified positions through a preset compression algorithm to obtain the transformed pixel values. According to the watermark information to be superimposed, the pixel features of each pixel at the corresponding position of the watermark are selected. According to the pixel features of each pixel, it is judged whether the transformed pixel values need to be modified through a preset rule. If modification is required, the brightness of the pixel to be modified is obtained and modified to obtain the superimposed image, so as to realize the judgment of whether the corresponding pixels need to be modified through a preset rule, and the modified superimposed image is obtained through the modification of the corresponding pixels.
[0152] To illustrate the method of the embodiment of the present application, the following is described in conjunction with specific embodiments of watermark superimposition:
[0153] The watermark superimposition process is mainly divided into the following several parts: binary error correction code encoding of the watermark, determination of the watermark superimposition position, and three steps of watermark data superimposition.
[0154] The overall process may include the following steps:
[0155] First, the watermark is encoded into an error correction code, which has the ability to correct errors bit by bit. Subsequently, the watermark superimposition position is generated according to the characteristics of the picture, and the watermark is superimposed at the specified position to determine the watermark superimposition position. After confirming the watermark superimposition position, the bit information of the watermark is converted into image information and stored in the image.
[0156] Binary error correction code encoding:
[0157] Binary error correction code encoding uses BCH error correction code encoding method and is selected according to the length of the valid data sent by the user. Currently, bch(63, 39) encoding is supported, with a total data length of 63 bits and a valid data length of 39 bits.
[0158] Watermark superimposition position selection:
[0159] The watermark superimposition position is determined by the basic features of the image. The existing image features of the image will generate independent numbers from 0 to 255, and the generated results will be used as indexes to obtain the superimposition position of the image from an array containing 64 different watermark superimposition positions.
[0160] The specific process is as follows:
[0161] a. Decode the original image into YUV data and take the Y value of the YUV data.
[0162] b. Perform bilinear interpolation scaling on the Y data to scale it into an 8*8 matrix.
[0163] c. Sum each Y value of the Y data and take the average value a.
[0164] d. Compare each element of the 8*8 matrix with the average value a. If the element is greater than a, take 1; otherwise, take 0.
[0165] e. Sum the elements of each row. If it is greater than 4, take 1; otherwise, take 0.
[0166] f. Use the formed 8-bit number as an index to obtain the position where the watermark is superimposed. A total of 9 position information (9 relative coordinates) are recorded for the superimposition position.
[0167] Superimposition of watermark information:
[0168] According to the first point of the relative coordinates, calculate the first absolute coordinate for superimposing the watermark. And starting from this point, take a square block with a side length of 8*8 as the watermark superimposition area. Each superimposed bit involves a superimposition area of 8*8. Complete the superimposition of each bit from left to right and from top to bottom. The watermark strength s can be set according to requirements. The higher the watermark strength, the better the recognition effect after taking a photo.
[0169] Calculate the DCT transform for each 8*8 pixel, and judge the relationship between the value V34 in the 3rd row and 4th column and the value V43 in the 4th row and 3rd column of the transformed data according to the Q value q of the encoded frame (picture or video frame). Record the bit information with the watermark strength of s.
[0170] a. When the bit value is 0, it is required that (V34 - V43) / q > s. If the condition is satisfied itself, the watermark is not modified. If the condition is not satisfied, the watermark is modified. If so, modify the values of V34 and V43. The modified value of V'34 is s*q + (V43 + V34) / 2, and the value of V'43 is (V43 + V34) / 2 - s*q.
[0171] b. When the bit value is 1, it is required that (V43 - V34) / q > s. If the condition is satisfied itself, the watermark is not modified. If the condition is not satisfied, modify the corresponding DCT coefficient value as follows: The modified value of V'43 is s*q + (V43 + V34) / 2, and the value of V'34 is (V43 + V34) / 2 - s*q
[0172] c. After performing the IDCT (inverse DCT) on the matrix with the modified DCT coefficients, it is the final 8*8 pixel block integrated with 1-bit watermark information
[0173] The above process is a watermark overlay process in absolute coordinates. The subsequent watermark overlay processes are the same, and so on, to complete the watermark data overlay at all positions.
[0174] In the actual use process, there are often situations where the watermark in the image with the pre-overlaid watermark is lost by taking pictures or other means. For this situation, in the second aspect of the embodiments of the present application, a watermark recovery method is provided. Refer to Figure 4 , Figure 4 which is a schematic flowchart of a watermark data recovery method provided by the embodiments of the present application, including:
[0175] Step S41, identifying the pixel features of each pixel point in the target image;
[0176] Step S42, calculating a target index value according to the identified pixel features of each pixel point;
[0177] Step S43, determining the target watermark position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and watermark position;
[0178] Step S44, extracting the pixels at the specified position according to the target watermark position;
[0179] Step S45, identifying the watermark information of the target watermark according to the pixels at the specified position.
[0180] The methods of steps S41 to S43 in the embodiments of the present application are similar to those of steps S11 to S13 in the above embodiments, and reference can be made to the above embodiments.
[0181] Specifically, calculating the target index value according to the identified pixel features of each pixel point may include creating a feature matrix according to the identified pixel features of each pixel point; scaling the feature matrix to generate a target matrix of a preset specification; reducing the dimension of the target matrix to obtain an index vector; and calculating the target index value according to the index vector.
[0182] When determining the target watermark position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and watermark position, the corresponding relationship between the pre-determined index value and the watermark position may be the same as the corresponding relationship between the pre-determined index value and the overlay position above.
[0183] When extracting the pixels at the specified position according to the target watermark position, it may be similar to the above implementation. For example, when the selected area is 8*8 pixels, through DCT transformation, and then selecting V43 and V34, that is, the pixels in the 4th row and 3rd column and the 3rd row and 4th column as the specified pixels.
[0184] When the watermark information of the target watermark is identified according to the pixels at the specified positions, all the watermarks at all positions can be counted, and the final suspected watermark before error correction can be selected through voting, and the error correction code can be decoded to complete the watermark recovery.
[0185] It can be seen that through the method of the embodiment of the present application, the pixel features of each pixel point in the target image to be processed can be identified. According to the identified pixel features of each pixel point, the target index value is calculated. According to the target index value and the pre-determined correspondence between the index value and the watermark position, the target watermark position corresponding to the target index value is determined. According to the target watermark position, the pixels at the specified positions are extracted. According to the pixels at the specified positions, the watermark information of the target watermark is identified, so as to realize the recovery of the watermark, improve the efficiency of watermark recovery, and optimize the image quality.
[0186] Optionally, referring to Figure 5 , step S41 of identifying the pixel features of each pixel point in the target image to be processed includes:
[0187] Step S411, obtaining the image to be recovered;
[0188] Step S412, performing correction on the image to be corrected through perspective transformation to obtain the target image.
[0189] Among them, the image perspective transformation is mainly to correct the image distortion phenomenon after photographing. Through the perspective transformation, the distorted image can be restored to the resolution before photographing. If the coordinates of the photographed image are u and v. The corresponding target resolution after transformation is x and y;
[0190]
[0191] Among them, (u, v) is the pixel coordinate after photographing, ω takes the value of 1, the converted coordinates are x = x' / w', y = y' / w', a 11 ……a 33 represents the elements in the transformation matrix.
[0192] Optionally, referring to Figure 6 , the watermark information includes multiple watermark data. Identifying the watermark information of the target watermark according to the pixels at the specified positions includes:
[0193] Step S61, identifying multiple watermark data to be determined according to the pixels at the specified positions;
[0194] Step S62, calculating the similarity between any watermark data to be determined and the preset watermark;
[0195] Step S63, selecting the watermark data corresponding to the similarity greater than the preset threshold among the multiple watermark data to be determined to obtain the watermark information to be determined;
[0196] Step S64: Calculate the watermark information of the target watermark through a preset algorithm according to the watermark information to be determined.
[0197] Among them, according to the pixels at the specified positions, multiple pieces of watermark data to be determined are identified. The first absolute coordinate of the superimposed watermark can be calculated based on the first point of the relative coordinates. For example, starting from this point, a square block with a side length of 8*8 is taken as the watermark superimposition area, and each superimposed bit involves a superimposition area of 8*8. From left to right and from top to bottom, each bit of the watermark is restored in sequence. During restoration, an IDC transform is performed on each 8*8 watermark block, and the values V34 in the 3rd row and 4th column and V43 in the 4th row and 3rd column of the transformed data are compared. If V34 > V43, this bit is taken as 0, otherwise it is taken as 1, thereby obtaining multiple pieces of watermark data to be determined. Since the watermark data is photographed, some data has a certain probability of being eliminated. First, the suspected watermark data needs to be found, and then the suspected watermark array is found based on the suspected watermark data for watermark data restoration. a. All watermark data is compared in a pairwise loop to find the two watermarks with the highest similarity. b. Watermarks are selected from the remaining watermarks and compared with the watermarks in a respectively. If the similarity of one of them is greater than 0.9, the watermark is retained in the new array. c. The voting algorithm is used to calculate the final invisible watermark data to be decoded by BCH: The sum of each bit of data in the watermark group is calculated. If the sum is greater than half of the product of the number of watermark groups and the number of watermarks, this bit is finally taken as 1, otherwise it is taken as 0.
[0198] According to the watermark information to be determined, the watermark information of the target watermark can be calculated through a preset algorithm. The watermark information can be identified according to the encoding rule of the watermark information. For example, the invisible watermark is decrypted according to the decryption method of bch(63, 39).
[0199] To illustrate the method of the embodiments of the present application, the following is described in conjunction with specific embodiments:
[0200] The process of watermark data restoration is the reverse process of superimposition, which is specifically divided into five parts: For the video and picture images after photographing, first, perspective transformation is used (for distortion correction to correct to the resolution before photographing), and then the same method as superimposition is used to confirm the position of watermark superimposition. After confirming the position of watermark superimposition, the watermarks at all positions are counted, and the final suspected watermark before adding error correction is screened out through voting, and the error correction code is decoded to complete watermark restoration. The following is introduced in steps:
[0201] Image distortion correction:
[0202] The main purpose of image perspective transformation is to correct the image distortion phenomenon after photographing. Through perspective transformation, the distorted image can be restored to the resolution before photographing. Let the coordinates corresponding to the photographed image be u, v, and the target resolution corresponding to the transformation be x, y.
[0203]
[0204] (u, v) are the pixel coordinates after taking a photo, ω takes the value of 1, and the converted coordinates are x = x’ / w’, y = y’ / w’.
[0205] Calculation of the watermark overlay position:
[0206] The method for calculating the position during watermark overlay is the same. The coordinates of all watermark positions will be stored in a position array.
[0207] Recovery of single coordinate watermark information
[0208] Based on the first point of the relative coordinates, calculate the first absolute coordinate of the overlay watermark. Taking this as the starting point, a square block with a side length of 8*8 is taken as the watermark overlay area, and each overlay bit involves an overlay area of 8*8. The watermark recovery of each bit is completed sequentially from left to right and from top to bottom.
[0209] During recovery, perform an IDC transformation on each 8*8 watermark block, and compare the value V34 in the 3rd row and 4th column and the value V43 in the 4th row and 3rd column of the transformed data. If V34 > V43, this bit takes 0, otherwise it takes 1.
[0210] Obtain the overlay watermark array according to this method.
[0211] Recovery of all overlay position watermark data groups:
[0212] Since the watermark data has been photographed and some data has a certain probability of being eliminated, it is first necessary to find the suspected watermark data, and then find the suspected watermark array based on the suspected watermark data for watermark data recovery.
[0213] a. Compare all watermark data in pairs in a loop to find the two watermarks with the highest similarity.
[0214] b. Select watermarks from the remaining watermarks and compare them with the watermarks in a respectively. If the similarity of one is greater than 0.9, the watermark is retained in the new array.
[0215] c. Use the voting algorithm to calculate the final invisible watermark data to be decoded by BCH: Sum each bit of data in the watermark group. If the sum is greater than half of the number of watermark groups multiplied by the number of watermarks, this bit finally takes 1, otherwise it takes 0.
[0216] Watermark data recovery:
[0217] Decrypt the invisible watermark according to the decryption method of bch(63, 39).
[0218] In the third aspect of the embodiments of the present application, a watermark overlay device is provided. Refer to Figure 7 , including:
[0219] A feature recognition module 701, configured to recognize the pixel features of each pixel point in the image to be processed;
[0220] An index value calculation module 702, configured to calculate a target index value according to the recognized pixel features of each pixel point;
[0221] A position determination module 703, configured to determine a target overlay position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and overlay position;
[0222] An image generation module 704, configured to modify the pixels at the target overlay position according to the watermark information to be overlaid, so as to obtain an overlaid image.
[0223] Optionally, the index value calculation module 702 includes:
[0224] A matrix creation sub-module, configured to create a feature matrix according to the recognized pixel values of each pixel point;
[0225] A matrix scaling sub-module, configured to scale the feature matrix to generate a target matrix with a preset specification;
[0226] A matrix dimensionality reduction sub-module, configured to reduce the dimensionality of the target matrix to obtain a target index value.
[0227] Optionally, the above device further includes:
[0228] An information encoding module, configured to encode the watermark information to be overlaid;
[0229] The image generation module 704 is specifically configured to modify the pixels at the target overlay position according to the encoded watermark information to obtain an overlaid image.
[0230] Optionally, the image generation module 704 includes:
[0231] A pixel selection sub-module, configured to select pixels at a specified position in the area to be overlaid;
[0232] A pixel compression sub-module, configured to perform a compression transformation on the pixels at the specified position through a preset compression algorithm to obtain transformed pixel values;
[0233] A feature selection sub-module, configured to select the pixel features of each pixel at the corresponding position of the watermark according to the watermark information to be overlaid;
[0234] A modification judgment sub-module, configured to judge whether the transformed pixel values need to be modified according to the pixel features of each pixel through a preset rule;
[0235] A brightness modification sub-module, which is used to modify the brightness of the pixels to be modified if modification is required, so as to obtain the superimposed image.
[0236] Optionally, the modification determination sub-module includes:
[0237] A pixel selection unit, which is used to select a first pixel at a first adjacent position and a second pixel at a second adjacent position for any pixel;
[0238] A ratio calculation unit, which is used to calculate the ratio of the difference between the first pixel and the second pixel to the pre-obtained image quality characteristic value, where the image quality characteristic value is a characteristic parameter representing the image quality;
[0239] A modification determination unit, which is used to determine that modification is required if the ratio is greater than the preset watermark strength, otherwise determine that modification is not required.
[0240] It can be seen that through the device in the embodiment of the present application, the corresponding relationship between the index value and the superimposition position can be preset first, and then the target index value can be calculated according to the pixel characteristics of each pixel point in the image to be processed, so as to determine the target superimposition position corresponding to the target index value and perform the superimposition of the watermark, which can realize the rapid determination of the watermark superimposition position, thereby improving the efficiency of calculating the watermark superimposition position during the watermark superimposition process and solving the problem of complex calculation of the watermark superimposition position during the watermark superimposition process.
[0241] In the fourth aspect of the embodiment of the present application, a watermark recovery device is provided. Refer to Figure 8 , including:
[0242] An image recognition module 801, which is used to recognize the pixel characteristics of each pixel point in the target image;
[0243] A feature calculation module 802, which is used to calculate the target index value according to the recognized pixel characteristics of each pixel point;
[0244] A watermark determination module 803, which is used to determine the target watermark position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and watermark position;
[0245] A pixel extraction module 804, which is used to extract the pixels at the specified position according to the target watermark position;
[0246] An information recognition module 805, which is used to recognize the watermark information of the target watermark according to the pixels at the specified position.
[0247] Optionally, the image recognition module 801 includes:
[0248] An image acquisition sub-module, which is used to acquire the image to be recovered;
[0249] An image correction sub-module, which is used to correct the image to be corrected through perspective transformation to obtain a target image.
[0250] Optionally, the watermark information includes multiple pieces of watermark data. The information recognition module 805 includes:
[0251] A data determination sub-module, which is used to identify multiple pieces of watermark data to be determined according to the pixels at the specified position;
[0252] A similarity calculation sub-module, which is used to calculate the similarity between any piece of watermark data to be determined and a preset watermark;
[0253] A data determination sub-module, which is used to select the watermark data corresponding to the similarity greater than the preset threshold among the multiple pieces of watermark data to be determined to obtain the watermark information to be determined;
[0254] A watermark calculation sub-module, which is used to calculate the watermark information of the target watermark through a preset algorithm according to the watermark information to be determined.
[0255] It can be seen that through the device in the embodiment of the present application, the pixel features of each pixel point in the target image can be recognized, the target index value can be calculated according to the recognized pixel features of each pixel point, and according to the target index value and the corresponding relationship between the pre-determined index value and the watermark position, the target watermark position corresponding to the target index value can be determined. According to the target watermark position, the pixels at the specified position are extracted, and according to the pixels at the specified position, the watermark information of the target watermark is recognized, so as to realize the restoration of the watermark, improve the efficiency of watermark restoration, and optimize the image quality.
[0256] The embodiment of the present application also provides an electronic device, as Figure 9 shown, including a processor 901, a communication interface 902, a memory 903, and a communication bus 904. Among them, the processor 901, the communication interface 902, and the memory 903 complete communication with each other through the communication bus 904.
[0257] The memory 903 is used to store a computer program;
[0258] When the processor 901 is used to execute the program stored in the memory 903, the following steps are implemented:
[0259] Recognize the pixel features of each pixel point in the image to be processed;
[0260] Calculate the target index value according to the recognized pixel features of each pixel point;
[0261] According to the target index value and the corresponding relationship between the pre-determined index value and the superimposition position, determine the target superimposition position corresponding to the target index value;
[0262] Modify the pixels at the target overlay position according to the watermark information to be overlaid, and obtain the overlaid image.
[0263] An embodiment of the present application further provides an electronic device, as Figure 10 shown, including a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004. Among them, the processor 1001, the communication interface 1002, and the memory 1003 complete mutual communication through the communication bus 1004.
[0264] The memory 1003 is used to store computer programs;
[0265] When the processor 1001 is used to execute the program stored on the memory 1003, the following steps are implemented:
[0266] Identify the pixel features of each pixel point in the target image;
[0267] Calculate the target index value according to the identified pixel features of each pixel point;
[0268] Determine the target watermark position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and watermark position;
[0269] Extract the pixels at the specified position according to the target watermark position;
[0270] Identify the watermark information of the target watermark according to the pixels at the specified position.
[0271] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity, only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0272] The communication interface is used for communication between the above electronic device and other devices.
[0273] The memory may include a Random Access Memory (RAM), or may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0274] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0275] In another embodiment provided by this application, there is also provided a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above watermark superimposition methods are implemented.
[0276] In another embodiment provided by this application, there is also provided a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above watermark recovery methods are implemented.
[0277] In another embodiment provided by this application, there is also provided a computer program product containing instructions. When it runs on a computer, the computer is made to execute any of the watermark superimposition methods in the above embodiments.
[0278] In another embodiment provided by this application, there is also provided a computer program product containing instructions. When it runs on a computer, the computer is made to execute any of the watermark recovery methods in the above embodiments.
[0279] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0280] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.
[0281] Each embodiment in this specification is described in a related manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the embodiments of the device, electronic device, storage medium, and computer program product, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.
[0282] The foregoing are only the preferred embodiments of the present application and are not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application are all included in the scope of protection of the present application.
Claims
1. A watermark superimposing method, characterized in that, Including: Identifying the pixel features of each pixel point in the image to be processed; Calculating a target index value according to the identified pixel features of each of the pixel points; Determining a target superposition position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and superposition position; Modifying the pixels at the target superposition position according to the watermark information to be superimposed to obtain a superimposed image; The modifying the pixels at the target superposition position according to the watermark information to be superimposed to obtain a superimposed image includes: Selecting the pixels at a specified position in the area to be superimposed; Performing compression transformation on the pixels at the specified position through a preset compression algorithm to obtain transformed pixel values; Selecting the pixel features of each pixel at the corresponding position of the watermark according to the watermark information to be superimposed; Judging whether the transformed pixel values need to be modified according to the pixel features of each of the pixels through a preset rule; If modification is needed, modifying the brightness of the pixels to be modified to obtain a superimposed image.
2. The method according to claim 1, wherein The calculating a target index value according to the identified pixel features of each of the pixel points includes: Creating a feature matrix according to the identified pixel values of each of the pixel points; Scaling the feature matrix to generate a target matrix of a preset specification; Reducing the dimension of the target matrix to obtain the target index value.
3. The method according to claim 1, wherein Before the modifying the pixels at the target superposition position according to the watermark information to be superimposed to obtain a superimposed image, the method further includes: Encoding the watermark information to be superimposed; The modifying the pixels at the target superposition position according to the watermark information to be superimposed to obtain a superimposed image includes: Modifying the pixels at the target superposition position according to the encoded watermark information to obtain a superimposed image.
4. The method according to claim 1, characterized in that, The judging whether the transformed pixel values need to be modified according to the pixel features of each of the pixels through a preset rule includes: For any pixel, selecting a first pixel at a first adjacent position and a second pixel at a second adjacent position of the pixel; Calculating the ratio of the difference between the first pixel and the second pixel to a pre-obtained image quality feature value, where the image quality feature value is a feature parameter representing the image quality; If the ratio is greater than a preset watermark strength, it is determined that modification is needed, otherwise it is determined that modification is not needed.
5. A watermark recovery method, characterized in that, Including: Identifying the pixel features of each pixel point in the target image; wherein, the target image is obtained according to the watermark superposition method according to any one of claims 1-4; Calculating a target index value according to the identified pixel features of each of the pixel points; Determining a target watermark position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and watermark position; Extracting the pixels at a specified position according to the target watermark position; Identifying the watermark information of the target watermark according to the pixels at the specified position.
6. The method according to claim 5, wherein The identifying the pixel features of each pixel point in the target image includes: Obtaining an image to be restored; Performing correction on the image to be corrected through perspective transformation to obtain the target image.
7. The method according to claim 6, wherein The watermark information includes multiple pieces of watermark data. The watermark information of the target watermark identified according to the pixels at the specified position includes: Identifying multiple pieces of to-be-determined watermark data according to the pixels at the specified position; For any piece of to-be-determined watermark data, calculating the similarity between the to-be-determined watermark and a preset watermark; Selecting the watermark data corresponding to the similarity greater than the preset threshold among the multiple pieces of to-be-determined watermark data to obtain the to-be-determined watermark information; Calculating the watermark information of the target watermark according to the to-be-determined watermark information through a preset algorithm.
8. A watermark superimposing device, characterized in that, Including: A feature recognition module for recognizing the pixel features of each pixel point in the image to be processed; An index value calculation module for calculating a target index value according to the recognized pixel features of each pixel point; A position determination module for determining the target superposition position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and superposition position; An image generation module for modifying the pixels at the target superposition position according to the watermark information to be superimposed to obtain the superimposed image; The image generation module includes: A pixel selection sub-module for selecting the pixels at the specified position in the area to be superimposed; A pixel compression sub-module for performing compression transformation on the pixels at the specified position through a preset compression algorithm to obtain the transformed pixel values; A feature selection sub-module for selecting the pixel features of each pixel at the corresponding position of the watermark according to the watermark information to be superimposed; A modification judgment sub-module for judging whether the transformed pixel values need to be modified through a preset rule according to the pixel features of each pixel; A brightness modification sub-module for modifying the brightness of the pixels to be modified if needed to obtain the superimposed image.
9. A watermark recovery device, characterized in that, Including: An image recognition module for recognizing the pixel features of each pixel point in the target image; wherein, the target image is obtained according to the watermark superimposition method according to any one of claims 1-4; A feature calculation module for calculating a target index value according to the recognized pixel features of each pixel point; A watermark determination module for determining the target watermark position corresponding to the target index value according to the corresponding relationship between the target index value and the pre-determined index value and watermark position; A pixel extraction module for extracting the pixels at the specified position according to the target watermark position; An information recognition module for recognizing the watermark information of the target watermark according to the pixels at the specified position.
Citation Information
Patent Citations
Image processing method and device, computer equipment and storage medium
CN114418825A
Robust blind watermarking method in wavelet DC components
US20030099373A1