Image watermark adding method, device, equipment and computer storage medium

By dividing the image into regions and using feature fusion and pixel grayscale value processing for different regions to add watermarks, the problem of watermarks being easily removed in existing technologies is solved, and the security and concealment of image watermarks are improved.

CN120047300BActive Publication Date: 2026-01-23CHINA MOBILE INTERNET CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411924254.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2026-01-23
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

When adding watermarks to images using existing technologies, the watermarks can be easily removed, resulting in low image security and easy theft.

Method used

By dividing the image into regions, different watermarking methods are used for different regions. This includes extracting and fusing high-frequency and low-frequency features in regions with complex features, and embedding watermarks based on pixel grayscale values ​​in regions with simple features, thereby enhancing the concealment and security of the watermark.

Benefits of technology

It improves the concealment and security of watermarks in images, reduces the difficulty of detecting and removing watermarks, and enhances the overall consistency and visual quality of images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047300B_ABST
    Figure CN120047300B_ABST
Patent Text Reader

Abstract

The application discloses a method, device and equipment for image watermark adding and a computer storage medium, and relates to the technical field of image security. The method comprises the following steps: acquiring a to-be-processed image and a watermark image; performing regional division on the to-be-processed image according to image region image types to obtain divided regions; in the case that the divided regions comprise a first region, performing feature extraction on the image of the first region and the watermark image respectively and performing feature fusion on the images respectively to obtain fused high-frequency features and fused low-frequency features, determining first target features corresponding to the fused high-frequency features and the fused low-frequency features according to the high-frequency features and the low-frequency features, and obtaining a target first region image; and / or in the case that the regions comprise a second region, determining second target features according to pixel point gray values of the image of the second region and pixel point gray values of the watermark image, and obtaining a target second region image. According to the application, watermark embedding is performed according to the division of different regions, and the security of the image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image security technology, and in particular relates to a method, apparatus, device and computer storage medium for adding image watermarks. Background Technology

[0002] With the development of the Internet, there is an increasing amount of image data on Internet platforms. In order to solve the problem of unauthorized use of images, watermarks can be added to the images to identify their source.

[0003] Existing methods for adding watermarks to images often involve directly adding the watermark to a fixed position on the image. This makes the watermark easy to remove using watermark removal techniques, and the image is easily stolen, resulting in low security for existing watermarked images. Summary of the Invention

[0004] This application provides a method, apparatus, device, and computer storage medium for adding image watermarks to address the problem of low security in existing watermarked images.

[0005] In a first aspect, embodiments of this application provide a method for adding an image watermark, the method comprising:

[0006] Obtain the image to be processed and the watermark image;

[0007] The image to be processed is divided into regions according to the image region and image type, resulting in the divided regions;

[0008] When the region is divided into two parts, the high-frequency features and low-frequency features of the image and watermark image of the first region are extracted respectively. The high-frequency features and low-frequency features of the image and watermark image of the first region are fused respectively to obtain fused high-frequency features and fused low-frequency features. The first target feature corresponding to the fused high-frequency features and fused low-frequency features is determined according to the relationship between the high-frequency features, low-frequency features and target features. The target first region image corresponding to the first target feature is obtained. Among them, the high-frequency features are features whose feature values ​​exceed the set threshold, and the low-frequency features are features whose feature values ​​do not exceed the set threshold.

[0009] And / or, if the region includes the second region, determine the second target feature based on the pixel grayscale values ​​of the second region image and the pixel grayscale values ​​of the watermark image, and obtain the target second region image corresponding to the second target feature.

[0010] Secondly, embodiments of this application provide an apparatus for adding image watermarks, the apparatus comprising:

[0011] The acquisition module is used to acquire the image to be processed and the watermark image;

[0012] The segmentation module is used to divide the image to be processed into regions according to the image region and image type, thereby obtaining the segmented regions.

[0013] The determination module is used to extract features from the image of the first region and the watermark image when the region is divided into regions including the first region, to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image respectively, to perform feature fusion on the high-frequency features of the image of the first region and the watermark image and the low-frequency features of the image of the first region and the watermark image respectively, to obtain fused high-frequency features and fused low-frequency features, and to determine the first target feature corresponding to the fused high-frequency features and fused low-frequency features according to the relationship between the high-frequency features, low-frequency features and target features, to obtain the target first region image corresponding to the first target feature, wherein the high-frequency features are features whose feature values ​​exceed a set threshold, and the low-frequency features are features whose feature values ​​do not exceed a set threshold;

[0014] The determining module is also used to, and / or when the region includes a second region, determine a second target feature based on the pixel grayscale values ​​of the second region image and the pixel grayscale values ​​of the watermark image, thereby obtaining a target second region image corresponding to the second target feature.

[0015] Thirdly, embodiments of this application provide a terminal device, the device including: a processor and a memory storing computer program instructions; the processor executes the computer program instructions to implement the image watermarking method as described in the first aspect.

[0016] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the image watermarking method as described in the first aspect.

[0017] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform an image watermarking method as described in the first aspect.

[0018] This application provides a method, apparatus, device, and computer storage medium for adding image watermarks. The method acquires an image to be processed and a watermark image, and divides the image to be processed into regions, allowing different watermarking methods to be used for different regions of the image. When the region is a first region, feature extraction is performed on the image of the first region and the watermark image to obtain high-frequency and low-frequency features respectively, which are then fused. A first target feature is determined based on the fused high-frequency and low-frequency features, and finally, a first region for watermarking is generated based on the first target feature. High-frequency features typically contain image details and edge information, while low-frequency features reflect the overall structure and brightness information of the image, enabling a more comprehensive capture of the image's complex information. By fusing the high-frequency and low-frequency features of the image and the watermark, the overall consistency of the image and the concealment of the watermark can be enhanced. When the region is a second region, a second target feature is determined based on the pixel grayscale values ​​of the image of the second region and the pixel grayscale values ​​of the watermark image, and a second region for watermarking is generated based on the second target feature. Directly embedding the watermark based on pixel grayscale values ​​simplifies the processing. This application embodiment divides the image into regions and embeds watermarks according to the characteristics and needs of different regions. In the first region, high-frequency features and low-frequency features are extracted and fused to improve the concealment of watermark information in the image. In the second region, calculations are performed based on pixels, thereby improving the security of the watermarked image. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating the method for adding an image watermark provided in an embodiment of this application;

[0021] Figure 2 This is a schematic diagram of the process for generating gradient feature matrices provided in an embodiment of this application;

[0022] Figure 3 This is a schematic diagram of the image distribution area provided in the embodiments of this application;

[0023] Figure 4 The present application provides a schematic diagram of the feature fusion process in its embodiments;

[0024] Figure 5 This is a flowchart illustrating the process of determining the second target feature provided in an embodiment of this application;

[0025] Figure 6This is a schematic diagram of the structure of the image watermarking device provided in the embodiments of this application;

[0026] Figure 7 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. Detailed Implementation

[0027] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0028] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0029] Current technologies for adding watermarks to images often place the watermark directly in a fixed position on the image. This makes the watermark easily removable, leading to vulnerability to image theft and resulting in low security for watermarked images. Criminals can exploit user-generated images for theft, such as posting them on personal social media accounts to attract traffic or even commit fraud, seriously threatening user information security.

[0030] To address the problems of existing technologies, this application provides a method, apparatus, device, and computer storage medium for adding image watermarks. The method acquires an image to be processed and a watermark image, and divides the image to be processed into regions, allowing different watermarking methods to be used for different regions of the image. When the region is a first region, feature extraction is performed on the image of the first region and the watermark image to obtain high-frequency and low-frequency features respectively, which are then fused. A first target feature is determined based on the fused high-frequency and low-frequency features, and finally, a first region for watermarking is generated based on the first target feature. High-frequency features typically contain image details and edge information, while low-frequency features reflect the overall structure and brightness information of the image, enabling a more comprehensive capture of the image's complex information. By fusing the high-frequency and low-frequency features of the image and the watermark, the overall consistency of the image and the concealment of the watermark can be enhanced. When the region is a second region, a second target feature is determined based on the pixel grayscale values ​​of the image of the second region and the pixel grayscale values ​​of the watermark image, and a second region for watermarking is generated based on the second target feature. Directly embedding the watermark based on pixel grayscale values ​​simplifies the processing. This application embodiment divides the image into regions and embeds watermarks according to the characteristics and needs of different regions. In the first region, high-frequency features and low-frequency features are extracted and fused to improve the concealment of watermark information in the image. In the second region, calculations are performed based on pixels, thereby improving the security of the watermarked image.

[0031] The method for adding image watermarks provided in the embodiments of this application will be described below with reference to the accompanying drawings.

[0032] Figure 1 This diagram illustrates a flowchart of an image watermarking method according to an embodiment of this application. Figure 1 As shown, the method may include the following steps: S101 to S104.

[0033] S101, Obtain the image to be processed and the watermark image.

[0034] The image to be processed is the original image to which a watermark is to be added, and the watermark image is the identification pattern or information to be embedded in the original image.

[0035] The image to be processed can be an image uploaded by the user, or an image that is bound to the corresponding software and input into the system by the software. The watermark image can be an image uploaded by the user, or a watermark automatically generated based on user information, usually in the form of a pixel matrix.

[0036] Obtain the original image to be watermarked and the image to be watermarked, in order to determine which images will be processed and the content of the watermark.

[0037] S102, the image to be processed is divided into regions according to the image region and image type to obtain the divided regions.

[0038] Since different regions have different feature complexities, different regions may require different watermark strengths and types. Therefore, after region segmentation, the image to be processed can be divided into a first region and a second region, where the first region can be a region with complex features and the second region can be a region with simple features.

[0039] In some embodiments, when dividing the image to be processed into regions, image segmentation techniques are used, which may include methods such as threshold segmentation, region growing, and clustering to divide the image into different regions.

[0040] Among them, the threshold segmentation method sets one or more thresholds, compares the gray values ​​of the image with the thresholds, and divides the region of the image to be processed according to the comparison result, and regards the image regions with the same comparison result as regions of the same type.

[0041] The region growing method is based on pixel neighborhood segmentation. Starting from one or more seed points, neighboring pixels are added to the seed region according to preset rules, such as the similarity of pixel values, until the stopping condition is met. Each seed region is used as a segmentation region.

[0042] Clustering methods are based on statistics and divide the pixels or regions of an image into a finite number of clusters, with each cluster serving as a partitioned region of the image to be processed.

[0043] By dividing the image into regions, specific watermarking methods can be applied to each region, thereby improving the adaptability and effectiveness of the watermark.

[0044] S103, when the region division includes the first region, feature extraction is performed on the image of the first region and the watermark image to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image respectively. Feature fusion is performed on the high-frequency features of the image of the first region and the watermark image, and the low-frequency features of the image of the first region and the watermark image respectively to obtain fused high-frequency features and fused low-frequency features. The first target feature corresponding to the fused high-frequency features and fused low-frequency features is determined according to the relationship between the high-frequency features, low-frequency features and target features, and the target first region image corresponding to the first target feature is obtained. Among them, the high-frequency features are features whose feature values ​​exceed the set threshold, and the low-frequency features are features whose feature values ​​do not exceed the set threshold.

[0045] The first region can be a region with complex features, such as a region containing multiple textures and structures, a region with large variations in color and brightness that results in uneven pixel value distribution, or an image region containing multiple different shapes. High-frequency features can include detailed information of the image, such as edges and textures, while low-frequency features can include smooth areas and overall information of the image. The first target feature is a feature that incorporates watermark information.

[0046] In some embodiments, when obtaining the target first region image corresponding to the first target feature, the frequency domain representation can be converted into image data by transformation methods such as Discrete Cosine Transform (DCT), Discrete Fourier Transform (DFT), or Wavelet Transform.

[0047] By fusing high-frequency and low-frequency features, the added watermark is more difficult to detect and remove, thus improving the security of the watermark. Furthermore, by integrating the watermark into the image through feature fusion, the impact of the watermark on the visual quality of the image can be reduced.

[0048] S104, and / or if the region includes the second region, determine the second target feature based on the pixel grayscale values ​​of the second region image and the pixel grayscale values ​​of the watermark image, and obtain the target second region image corresponding to the second target feature.

[0049] The second region can be a region with simple features, a region with a single texture structure and no complex patterns or structures, a region with little variation in color or grayscale values ​​and a relatively uniform distribution, or a region with simple details, few edges, and a relatively uniform distribution of color or grayscale.

[0050] In some embodiments, when determining the second target feature based on the pixel grayscale values ​​of the second region image and the watermark image, the watermark image can be directly superimposed onto the corresponding pixels of the second region image, and the pixel values ​​of the second region image can be adjusted based on the difference between the grayscale values ​​of the watermark image and the second region image.

[0051] Watermarks are added by directly assigning pixel grayscale values ​​to regions with simple features. This method is simple to calculate and easy to implement, which can reduce the consumption of computing resources and improve processing efficiency.

[0052] In some embodiments, the methods for obtaining the target first region image and the target second region image can be used in combination or individually. For example, when the image to be processed has only the first region in its divided regions, the method for obtaining the target first region image can be used to add a watermark; when the image to be processed has only the second region in its divided regions, the method for obtaining the target second region image can be used to add a watermark.

[0053] When the image to be processed includes both a first region and a second region, the following methods can be used: First region can be watermarked only to obtain the target first region image, while the second region remains unprocessed. The watermarked image of the first region can then be used as the watermarked image. Alternatively, second region can be watermarked only to obtain the target second region image, while the first region remains unprocessed. The watermarked image of the second region can then be used as the watermarked image. Finally, both the first and second regions can be processed simultaneously to obtain the target first region image and the target second region image respectively. The combined image of the target first region image and the target second region image can then be used as the watermarked image.

[0054] First, the image to be processed and the watermark image are acquired, and the image to be processed is divided into regions. This allows the watermark to be added using different methods for different regions. In the case of a first region, feature extraction is performed on both the first region image and the watermark image to obtain high-frequency and low-frequency features, which are then fused. The first target feature is determined based on the fused high-frequency and low-frequency features, and finally, the first region for watermarking is generated based on the first target feature. High-frequency features typically contain image details and edge information, while low-frequency features reflect the overall structure and brightness information of the image, thus capturing more comprehensive complex information. By fusing the high-frequency and low-frequency features of the image and watermark, the overall consistency of the image and the concealment of the watermark can be enhanced. In the case of a second region, the second target feature is determined based on the pixel grayscale values ​​of the second region image and the watermark image, and the second region for watermarking is generated based on the second target feature. Directly embedding the watermark based on pixel grayscale values ​​simplifies the processing. This application embodiment divides the image into regions and embeds watermarks according to the characteristics and needs of different regions. In the first region, high-frequency features and low-frequency features are extracted and fused to improve the concealment of watermark information in the image. In the second region, calculations are performed based on pixels, thereby improving the security of the watermarked image.

[0055] In some embodiments, dividing the image to be processed into regions according to the image region type to obtain the divided regions may include:

[0056] Gradient features are extracted from the image to be processed, and a feature vector matrix is ​​generated based on the extracted gradient features, where the gradient features represent the image type.

[0057] Based on the eigenvector values ​​of the eigenvector matrix, the image to be processed is divided into regions, thus obtaining the divided regions of the image.

[0058] By extracting features and generating a feature vector matrix, a numerical representation is provided for each region of the image, indicating the complexity of the region, and the region is divided according to the feature vector values.

[0059] The image type represented by gradient features can be either complex or simple.

[0060] In some embodiments, gradient feature extraction of the image to be processed can be performed using methods such as the Sobel operator, Canny edge detection, Prewitt operator, and Laplacian operator.

[0061] In some embodiments, the image to be processed is divided into regions based on the eigenvector values ​​of the eigenvector matrix to obtain the divided regions of the image to be processed, which may include:

[0062] Clustering is performed on the eigenvector matrix based on the distance between eigenvectors in the eigenvector matrix to obtain the clustering results of the eigenvectors. The clustering results of the eigenvectors include clusters composed of multiple eigenvectors.

[0063] Determine the mean of the eigenvectors of the eigenvectors in the cluster;

[0064] The image regions corresponding to the feature vectors in the cluster that exceed the mean of the feature vectors are divided into the first region;

[0065] The image regions corresponding to feature vectors in the cluster that do not exceed the mean of the feature vectors are divided into the second region.

[0066] Different regions in an image have different feature complexities, so different regions may require different processing strategies. Clustering can help identify regions with similar features, thus enabling targeted processing.

[0067] In some embodiments, such as Figure 2 As shown, gradient feature extraction is performed on the image to be processed, and a gradient feature matrix is ​​generated based on the extracted gradient features, which may include: S201 to S205.

[0068] S201, Convert the image to be processed into a grayscale image;

[0069] S202, divide the grayscale image into multiple grayscale image regions of preset size;

[0070] S203, perform gradient feature extraction on the grayscale image region according to the preset convolution kernel to obtain the gradient direction of each pixel in the grayscale image region;

[0071] S204, determine the gradient direction frequency of the grayscale image region based on the gradient direction, and generate a gradient histogram based on the gradient direction frequency;

[0072] S205, generate a gradient feature matrix by combining the gradient histograms of all grayscale image regions.

[0073] By determining the gradient direction of each image region and generating a gradient feature matrix, a global feature representation of the entire image can be provided, capturing multi-scale feature information, which is helpful for image analysis and understanding.

[0074] In some embodiments, gradient feature extraction is performed on the grayscale image region according to a preset convolution kernel to obtain the gradient direction of each pixel in the grayscale image region, which may include:

[0075] The pixels in the grayscale image region are weighted and summed according to the preset horizontal convolution kernel and the preset vertical convolution kernel respectively to obtain the horizontal gradient value and the vertical gradient value of the pixel.

[0076] The gradient direction of a pixel is determined based on its horizontal and vertical gradient values.

[0077] In some embodiments, the gradient direction of a pixel is determined based on the horizontal and vertical gradient values, and the formula can be:

[0078]

[0079] Where θ is the gradient direction of the pixel, G y G is the vertical gradient value. x This represents the horizontal gradient value.

[0080] In some embodiments, clustering the eigenvector matrix based on the distance between eigenvectors in the eigenvector matrix to obtain the clustering result of the eigenvectors may include:

[0081] Randomly select target feature vectors from a preset number of feature vector matrices as cluster centers;

[0082] Calculate the vector distance between the remaining feature vectors and the cluster centers;

[0083] The remaining feature vectors are assigned to the cluster corresponding to the target cluster center with the smallest vector distance, and the remaining feature vectors are adjacent to the image regions corresponding to the clusters of the target cluster centers;

[0084] Calculate the mean of the eigenvectors of all eigenvectors within each cluster, and update the target cluster center based on the eigenvector with the smallest difference from the mean of the eigenvectors within the cluster;

[0085] When the cluster centers are updated, the corresponding clusters and their corresponding cluster centers are updated based on the updated cluster centers until the cluster centers no longer change, thus obtaining the feature vector clustering result.

[0086] Considering the adjacency of the image regions corresponding to the feature vectors helps to maintain spatial continuity and consistency. The cluster centers are updated by calculating the mean of the feature vectors within the cluster, making the clustering results more stable and accurate.

[0087] In one example, the obtained image distribution area is as follows: Figure 3 As shown, the image includes the first regions A3 and A4, which are regions with complex features, and the second regions A1 and A2, which are regions with simple features. Regions with complex features are easier to watermark with richer information without affecting the visual appeal; regions with simple features can have watermarks with simple information added without affecting the image's display.

[0088] In some embodiments, feature extraction of the image of the first region and the watermark image to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image respectively may include:

[0089] Feature extraction is performed on the image of the first region and the watermark image to obtain the features of the image of the first region and the features of the watermark image;

[0090] Calculate the window energy of the first region image and the window energy of the watermark image based on the features of the first region image and the watermark image, respectively.

[0091] Based on the preset window energy threshold, the window energy of the first region image, and the window energy of the watermark image, the features of the first region image and the watermark image are divided to obtain the high-frequency features and low-frequency features of the first region image and the watermark image, respectively.

[0092] Using window energy as the basis for feature segmentation, the window energy threshold can be dynamically adjusted according to image content and application requirements to obtain the best high-frequency and low-frequency features. By combining the high-frequency features of the watermark with the high-frequency features of the image, the concealment of the watermark can be improved, making it more difficult to detect and remove.

[0093] In some embodiments, the image of the first region is denoted as P, the watermark image is denoted as y, and the window energy of the center point of the image is calculated. The formula for calculating the window energy with (j, k) as the center point can be:

[0094]

[0095] Among them, W l,v (j,k) represents the window energy centered at point (j,k), l represents the eigenvalue decomposition dimension, v represents image p or image y, Q(m,n) is the neighborhood function, representing the weight or coefficient within a local region of the image, Q represents the neighborhood, m and n represent the relative position coordinates within the neighborhood Q, and G... l,v Let N be the feature energy value of image P or image y in the direction of dimension l of the feature decomposition, with (j, k) as the center point, and N be the size of the neighborhood.

[0096] In some embodiments, such as Figure 4 As shown, the high-frequency features of the image and watermark image of the first region, and the low-frequency features of the image and watermark image of the first region are respectively fused to obtain fused high-frequency features and fused low-frequency features, which may include: S401 to S403.

[0097] S401, Based on the high-frequency and low-frequency features of the image and watermark image of the first region, determine the neighborhood energy corresponding to the high-frequency and low-frequency features of the image and watermark image of the first region.

[0098] S402, compare the neighborhood energies corresponding to the high-frequency features of the image in the first region and the watermark image, and select the neighborhood energy corresponding to the larger neighborhood energy as the fused high-frequency feature;

[0099] S403, determine the fused low-frequency features based on the neighborhood energy corresponding to the low-frequency features of the image and watermark image of the first region.

[0100] By selecting and fusing high-frequency features corresponding to larger neighborhood energies, the watermark's resistance to attacks can be enhanced. By fusing low-frequency features, the visual effect of the image can be maintained, and excessive distortion can be avoided.

[0101] In some embodiments, determining the fused low-frequency features based on the neighborhood energy corresponding to the low-frequency features of the first region image and the watermark image may include:

[0102] The 3*3 or 2*2 neighborhood energy W of all feature elements in the low-frequency feature components of images P and y. P (j, k) and W y The formula for calculating the neighborhood energy of (j, k) is as follows:

[0103]

[0104] Among them, W P W is the neighborhood energy of the low-frequency feature components of image P. y Let N be the neighborhood energy of the low-frequency feature components of image y, and N be the size of the neighborhood.

[0105] For W P and W y After normalization, the normalized neighborhood energies are fused using the following formula:

[0106] H(j,k)=W p ×D p (j,k)+W y ×DD y (j,k)

[0107] Where H(j,k) is the value of the fused low-frequency feature at position (j,k), and D... p DD represents the high-frequency features of image p. y y represents the high-frequency features of the image y.

[0108] In some embodiments, comparing the neighborhood energies corresponding to the high-frequency features of the first region image and the watermark image, and selecting the neighborhood energy corresponding to the larger neighborhood energy as the fused high-frequency feature, may include:

[0109] The formula for calculating the 2*2 or 3*3 neighborhood energy corresponding to the high-frequency features of images P and y can be:

[0110]

[0111] Among them, C l,v (j,k) represents the neighborhood energy corresponding to the high-frequency feature of image P or image y at position (j,k), v represents image P or image y, and h = X, Y, Z represent the high-frequency feature vectors in the vertical, horizontal, and diagonal directions, respectively.

[0112] All element features are fused according to the strategy of maximizing the neighborhood energy contrast, and the formula can be:

[0113]

[0114] in, To integrate high-frequency features, The neighborhood energy of the image for the first region. The neighborhood energy of the watermarked image.

[0115] In some embodiments, determining the first target feature based on fused high-frequency features and fused low-frequency features may include:

[0116] The weighted difference is calculated based on the preset weights, the fused high-frequency features, and the fused low-frequency features;

[0117] The first target feature is calculated based on the weighted difference, the fusion of high-frequency features, and the fusion of low-frequency features.

[0118] The preset weights can be adjusted according to different application requirements to adapt to different image processing tasks; through weighted fusion, watermark features can be better hidden in the image, making them difficult to detect and remove, thus enhancing the security of the watermark.

[0119] In some embodiments, after extracting features from the image of the first region and the watermark image to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image respectively, and before determining the fused high-frequency features and fused low-frequency features based on the high-frequency features and low-frequency features of the image of the first region and the watermark image, the method may further include:

[0120] Convert the watermark image into a pixel array;

[0121] Randomly select the position of the pixel value to be replaced from a preset number of pixel arrays;

[0122] Determine the target pixel value based on the pixel value to be replaced;

[0123] The target pixel value is updated to the position of the pixel value to be replaced, and the target watermark image corresponding to the updated pixel array is obtained;

[0124] Update the high-frequency and low-frequency features of the watermark image based on the target watermark image.

[0125] By replacing pixel values, the complexity of cracking the watermark is increased, making the watermark more difficult to detect and enhancing its concealment.

[0126] In some embodiments, the image is divided into feature matrices of length M and width N, and the pixel values ​​of each block in the matrix are calculated to form a pixel value matrix. The pixel values ​​in the matrix are converted into a one-dimensional array with length U, where U = M × N, according to the row-major principle.

[0127] In array U, two random pixel values ​​to be replaced are determined at positions D1 and D2. Position D1 is the sequential position m1 (m1 is taken sequentially from the first position), and position D2 is a random position. The formula for calculating the position to be replaced can be:

[0128]

[0129] D = mod(floor(d×10)) 8 ),U)+1,D1=m1

[0130] In this function, floor(x) returns the largest integer not greater than x, D is the intermediate value, d is the control parameter, d = log(M × N), U is the array length, and m1 is the order position.

[0131] If either D1 or D2 is selected repeatedly, skip that position. If the sequential position D1 is selected repeatedly, move D1 one position to the right, and D1 = m1 + 1. If the random position D2 has been selected repeatedly, move D2 one position to the right, and D2 = D2 + 1.

[0132] The pixel values ​​SD1 and SD2 at positions D1 and D2 are decomposed into a preset number of bit planes that are multiples of 2 (2X). The higher X bits and lower X bits of the bit plane are then flipped and swapped to obtain new grayscale pixel values ​​NSD1 and NSD2. The target pixel values ​​ZD1 and ZD2 are then calculated based on NSD1 and NSD2 using the following formula:

[0133]

[0134] For regions with simple features (such as A1 and A2), if the embedding method of Method 1 is used, the embedding space will not be planned in advance, resulting in distortion of the carrier image and confusion of image features after the watermark is embedded. Therefore, by further segmenting the regions with simple features (such as A1 and A2) into textured and flat regions, and then embedding the plane of the binary representation of the textured region into the flat region based on the DCT coefficient modification algorithm, the purpose of reserving embedding space is achieved, thereby solving the problem that the embedded watermark image cannot be secretly embedded when the carrier image has few features.

[0135] In some embodiments, such as Figure 5 As shown, determining the second target feature based on the pixel grayscale values ​​of the second region image and the pixel grayscale values ​​of the watermark image may include: S501 to S504.

[0136] S501, Divide the image of the second region into regions according to the preset size to obtain the target region;

[0137] S502, calculates the texture complexity and embedding capacity of the target region based on the pixel grayscale value, height and width of the target region;

[0138] S503 calculates the watermark clarity of the target area based on texture complexity and embedding capacity;

[0139] S504, calculate the second target feature based on the pixel grayscale value of the target area and the pixel grayscale value of the watermark corresponding to the watermark clarity.

[0140] Calculating the embedding capacity helps determine the strength of watermark embedding in different regions. By precisely controlling the watermark embedding strength, image distortion caused by watermark embedding can be reduced, and the visual quality of the image can be maintained.

[0141] In some embodiments, if the width of a simple region is Ms and the length is Ns, then the number of sub-regions is 2.sn The value of sn is typically 1024, and this value can be adjusted according to the granularity of the pre-embedded content.

[0142] Ultimately, the size of each small area is

[0143] The formula for calculating texture complexity can be:

[0144]

[0145] Where W is the width of the tiny region, Pi,j is the gray value of the pixel in the i-th row and j-th column of the region image (positive on the left and negative on the right), ns is the width of the strip, m is the length of the data to be embedded, and n0 is the optimal starting position of the strip.

[0146] The formula for calculating the embedding capacity can be:

[0147] C s = ns × W - 2[1 bit × H]

[0148] Where H is the height of the small region.

[0149] The formula for calculating watermark clarity is as follows:

[0150]

[0151] Where res represents the watermark clarity.

[0152] Figure 6 This application illustrates an image watermarking device 600 according to an embodiment of the present application. The device may include:

[0153] The acquisition module 601 is used to acquire the image to be processed and the watermark image;

[0154] The segmentation module 602 is used to segment the image to be processed according to the image region and image type to obtain the segmented regions;

[0155] The determining module 603 is used to extract features from the image of the first region and the watermark image when the region is divided into regions including the first region, to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image respectively, to perform feature fusion on the high-frequency features of the image of the first region and the watermark image and the low-frequency features of the image of the first region and the watermark image respectively, to obtain fused high-frequency features and fused low-frequency features, and to determine the first target feature corresponding to the fused high-frequency features and fused low-frequency features according to the relationship between the high-frequency features, low-frequency features and target features, to obtain the target first region image corresponding to the first target feature, wherein the high-frequency features are features whose feature values ​​exceed a set threshold, and the low-frequency features are features whose feature values ​​do not exceed a set threshold;

[0156] The determining module 603 is further configured to, when the region includes the second region, determine the second target feature based on the pixel grayscale values ​​of the second region image and the pixel grayscale values ​​of the watermark image, and obtain the target second region image corresponding to the second target feature.

[0157] In some embodiments, the image watermarking device 600 may further include:

[0158] The extraction module is used to extract gradient features from the image to be processed and generate a feature vector matrix based on the extracted gradient features, where the gradient features represent the image type.

[0159] The segmentation module 602 is also used to segment the image to be processed based on the eigenvector values ​​of the eigenvector matrix, so as to obtain the segmented regions of the image to be processed.

[0160] In some embodiments, the image watermarking device 600 may further include:

[0161] The clustering module is used to cluster the feature vector matrix based on the distance between the feature vectors in the feature vector matrix, and obtain the clustering results of the feature vectors. The clustering results of the feature vectors include clusters composed of multiple feature vectors.

[0162] The determination module 603 is also used to determine the mean of the eigenvectors of the eigenvectors in the cluster;

[0163] The partitioning module 602 is also used to partition the image region corresponding to the feature vector that exceeds the mean of the feature vector in the cluster into the first region;

[0164] The partitioning module 602 is also used to partition the image region corresponding to the feature vector in the cluster that does not exceed the mean of the feature vector into a second region.

[0165] In some embodiments, the image watermarking device 600 may further include:

[0166] The conversion module is used to convert the image to be processed into a grayscale image;

[0167] The segmentation module 602 is also used to divide the grayscale image into multiple grayscale image regions of preset size;

[0168] The extraction module is also used to extract gradient features from the grayscale image region according to the preset convolution kernel, so as to obtain the gradient direction of each pixel in the grayscale image region;

[0169] The determining module 603 is also used to determine the gradient direction frequency of the grayscale image region based on the gradient direction, and generate a gradient histogram based on the gradient direction frequency.

[0170] The combination module is used to generate a gradient feature matrix by combining the gradient histograms of all grayscale image regions.

[0171] The calculation module is used to perform weighted summation on the pixels of the grayscale image region according to the preset horizontal convolution kernel and the preset vertical convolution kernel respectively, to obtain the horizontal gradient value and the vertical gradient value of the pixel.

[0172] The determination module 603 is also used to determine the gradient direction of a pixel based on the horizontal gradient value and the vertical gradient value.

[0173] In some embodiments, the image watermarking device 600 may further include:

[0174] The selection module is used to randomly select target feature vectors from a preset number of feature vector matrices as cluster centers.

[0175] The calculation module is also used to calculate the vector distance between the remaining feature vectors and the cluster centers;

[0176] The allocation module is used to assign the remaining feature vectors to the clusters of the target cluster centers corresponding to the smallest vector distances, and the remaining feature vectors are adjacent to the image regions corresponding to the clusters of the target cluster centers;

[0177] The calculation module is also used to calculate the mean of the feature vectors of all feature vectors in each cluster, and update the target cluster center based on the feature vector with the smallest difference from the mean of the feature vectors in the cluster;

[0178] The update module is used to update the corresponding clusters and their corresponding cluster centers based on the updated cluster centers when the cluster centers are updated, until the cluster centers no longer change, thus obtaining the feature vector clustering results.

[0179] In some embodiments, the extraction module is further configured to perform feature extraction on the image of the first region and the watermark image to obtain the features of the image of the first region and the features of the watermark image;

[0180] The calculation module is also used to calculate the window energy of the image of the first region and the window energy of the watermark image based on the features of the image of the first region and the features of the watermark image, respectively.

[0181] The segmentation module 602 is also used to segment the features of the image of the first region and the features of the watermark image according to a preset window energy threshold, the window energy of the image of the first region and the window energy of the watermark image, so as to obtain the high-frequency features and low-frequency features of the image of the first region and the watermark image respectively.

[0182] In some embodiments, the determining module 603 is further configured to determine the neighborhood energy corresponding to the high-frequency features and low-frequency features of the image and watermark image of the first region based on the high-frequency features and low-frequency features of the image and watermark image of the first region.

[0183] The selection module is also used to compare the neighborhood energies corresponding to the high-frequency features of the image in the first region and the watermark image, and select the neighborhood energy corresponding to the larger neighborhood energy as the fused high-frequency feature.

[0184] The determining module 603 is also used to determine the fused low-frequency features based on the neighborhood energy corresponding to the low-frequency features of the image and the watermark image of the first region.

[0185] In some embodiments, the calculation module is further configured to calculate a weighted difference based on preset weights, fused high-frequency features, and fused low-frequency features;

[0186] The calculation module is also used to calculate the first target feature based on the weighted difference, the fused high-frequency feature, and the fused low-frequency feature.

[0187] In some embodiments, the conversion module is further configured to convert the watermark image into a pixel array;

[0188] The selection module is also used to randomly select the position of the pixel value to be replaced in a preset number of pixel arrays;

[0189] The determining module 603 is also used to determine the target pixel value based on the pixel value to be replaced;

[0190] The update module is also used to update the position of the pixel value to be replaced according to the target pixel value, so as to obtain the target watermark image corresponding to the updated pixel array;

[0191] The update module is also used to update the high-frequency and low-frequency features of the watermark image based on the target watermark image.

[0192] In some embodiments, the segmentation module 602 is further configured to segment the image of the second region according to a preset size to obtain the target region;

[0193] The calculation module is also used to calculate the texture complexity and embedding capacity of the target region based on the pixel grayscale value, height and width of the target region;

[0194] The calculation module is also used to calculate the watermark clarity of the target area based on texture complexity and embedding capacity;

[0195] The calculation module is also used to calculate the second target feature based on the pixel grayscale value of the target area and the pixel grayscale value of the watermark corresponding to the watermark clarity.

[0196] Figure 6The various modules in the device shown can achieve Figure 1 The various steps involved, and the corresponding technical effects achieved, will not be elaborated upon here for the sake of brevity.

[0197] Figure 7 A schematic diagram of the hardware structure of the terminal device provided in an embodiment of this application is shown.

[0198] The terminal device may include a processor 701 and a memory 702 storing computer program instructions.

[0199] Specifically, the processor 701 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0200] Memory 702 may include mass storage for data or instructions. For example, and not limitingly, memory 702 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 702 may include removable or non-removable (or fixed) media, or memory 702 may be non-volatile solid-state memory. Memory 702 may be internal or external to the integrated gateway disaster recovery device.

[0201] In one example, memory 702 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the image watermarking method according to this disclosure.

[0202] The processor 701 reads and executes computer program instructions stored in the memory 702 to achieve... Figure 1 The method for adding image watermarks in the illustrated embodiment.

[0203] In one example, the terminal device may also include a communication interface 703 and a bus 704. Wherein, for example... Figure 7As shown, the processor 701, memory 702, and communication interface 703 are connected through bus 704 and complete communication with each other.

[0204] The communication interface 703 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0205] Bus 704 includes hardware, software, or both, that couples components of an end device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 704 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0206] Furthermore, in conjunction with the image watermarking methods described in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the image watermarking methods described in the above embodiments.

[0207] This application also provides a computer program product, including a computer program, which, when executed, implements any of the image watermarking methods described in the above embodiments.

[0208] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0209] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or text segments used to perform the required tasks. Programs or text segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Text segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0210] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0211] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0212] The above are merely specific embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A method for adding watermarks to images, characterized in that, include: Obtain the image to be processed and the watermark image; The image to be processed is divided into regions according to the image type of the image region to obtain the divided regions; When the divided region includes a first region, feature extraction is performed on the image of the first region and the watermark image to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image, respectively. Feature fusion is performed on the high-frequency features of the image of the first region and the watermark image, and the low-frequency features of the image of the first region and the watermark image, respectively, to obtain fused high-frequency features and fused low-frequency features. Based on the relationship between high-frequency features, low-frequency features and target features, a first target feature corresponding to the fused high-frequency features and fused low-frequency features is determined to obtain the target first region image corresponding to the first target feature. Here, the high-frequency features are features whose feature values ​​exceed a set threshold, and the low-frequency features are features whose feature values ​​do not exceed a set threshold. When the region includes a second region, a second target feature is determined based on the pixel grayscale values ​​of the image of the second region and the pixel grayscale values ​​of the watermark image, thereby obtaining the target second region image corresponding to the second target feature; The step of dividing the image to be processed into regions according to the image type of the image region to obtain the divided regions includes: Gradient features are extracted from the image to be processed, and a feature vector matrix is ​​generated based on the extracted gradient features, wherein the gradient features represent the image type. Based on the eigenvector values ​​of the eigenvector matrix, the image to be processed is divided into regions to obtain the divided regions of the image to be processed.

2. The method for adding an image watermark according to claim 1, characterized in that, The step of dividing the image to be processed into regions based on the feature vector values ​​of the feature vector matrix to obtain the divided regions of the image to be processed includes: The feature vectors are clustered based on the distance between the feature vectors in the feature vector matrix to obtain the clustering results of the feature vectors, which include clusters composed of multiple feature vectors; Determine the mean of the eigenvectors of the eigenvectors in the cluster; The image regions corresponding to the feature vectors in the cluster that exceed the mean of the feature vectors are divided into the first region; The image regions corresponding to the feature vectors in the cluster that do not exceed the mean of the feature vectors are divided into the second region.

3. The method for adding an image watermark according to claim 1, characterized in that, The step of extracting gradient features from the image to be processed and generating a gradient feature matrix based on the extracted gradient features includes: Convert the image to be processed into a grayscale image; The grayscale image is divided into multiple grayscale image regions of preset sizes; Gradient features are extracted from the grayscale image region using a preset convolution kernel to obtain the gradient direction of each pixel in the grayscale image region; The gradient direction frequency of the grayscale image region is determined based on the gradient direction, and a gradient histogram is generated based on the gradient direction frequency. A gradient feature matrix is ​​generated by combining the gradient histograms of all grayscale image regions.

4. The method for adding an image watermark according to claim 3, characterized in that, The step of extracting gradient features from the grayscale image region according to a preset convolution kernel to obtain the gradient direction of each pixel in the grayscale image region includes: The pixels in the grayscale image region are weighted and summed according to the preset horizontal convolution kernel and the preset vertical convolution kernel respectively to obtain the horizontal gradient value and the vertical gradient value of the pixel. The gradient direction of the pixel is determined based on the horizontal and vertical gradient values.

5. The method for adding an image watermark according to claim 2, characterized in that, The clustering of the feature vectors based on the distance between feature vectors in the feature vector matrix, to obtain the clustering results of the feature vectors, includes: Randomly select target feature vectors from a preset number of feature vector matrices as cluster centers; Calculate the vector distance between the remaining feature vectors and the cluster centers; The remaining feature vectors are assigned to the cluster of the target cluster center corresponding to the smallest vector distance, and the remaining feature vectors are adjacent to the image regions corresponding to the clusters of the target cluster centers; Calculate the mean of the feature vectors of all feature vectors in each cluster, and update the target cluster center based on the feature vector with the smallest difference from the mean of the feature vectors in the cluster; When the cluster centers are updated, the corresponding clusters and their corresponding cluster centers are updated according to the updated cluster centers until the cluster centers no longer change, thus obtaining the feature vector clustering result.

6. The method for adding an image watermark according to claim 1, characterized in that, The step of extracting features from the image of the first region and the watermark image to obtain high-frequency and low-frequency features of the image of the first region and the watermark image, respectively, includes: Feature extraction is performed on the image of the first region and the watermark image to obtain the features of the image of the first region and the features of the watermark image. The window energy of the first region image and the window energy of the watermark image are calculated based on the features of the first region image and the watermark image, respectively. Based on the preset window energy threshold, the window energy of the first region image, and the window energy of the watermark image, the features of the first region image and the watermark image are divided to obtain the high-frequency features and low-frequency features of the first region image and the watermark image, respectively.

7. The method for adding an image watermark according to claim 1, characterized in that, The high-frequency features of the image and watermark image of the first region, and the low-frequency features of the image and watermark image of the first region, are respectively fused to obtain fused high-frequency features and fused low-frequency features, including: Based on the high-frequency and low-frequency features of the image and watermark image of the first region, determine the neighborhood energy corresponding to the high-frequency and low-frequency features of the image and watermark image of the first region. Compare the neighborhood energies corresponding to the high-frequency features of the first region image and the watermark image, and select the neighborhood energy corresponding to the larger neighborhood energy as the fused high-frequency feature; The fused low-frequency features are determined based on the neighborhood energy corresponding to the low-frequency features of the first region image and the watermark image.

8. The method for adding an image watermark according to claim 1, characterized in that, The step of determining the first target feature based on the fused high-frequency features and the fused low-frequency features includes: The weighted difference is calculated based on the preset weights, the fused high-frequency features, and the fused low-frequency features; The first target feature is calculated based on the weighted difference, the fused high-frequency feature, and the fused low-frequency feature.

9. The method for adding an image watermark according to any one of claims 1 to 8, characterized in that, After extracting features from the image of the first region and the watermark image to obtain high-frequency and low-frequency features of the image of the first region and the watermark image respectively, and before determining the fused high-frequency features and fused low-frequency features based on the high-frequency and low-frequency features of the image of the first region and the watermark image, the method further includes: Convert the watermark image into a pixel array; Randomly select the position of the pixel value to be replaced from a preset number of pixel arrays; Determine the target pixel value based on the pixel value to be replaced; The position of the pixel value to be replaced is updated according to the target pixel value to obtain the target watermark image corresponding to the updated pixel array; The high-frequency and low-frequency features of the watermark image are updated based on the target watermark image.

10. The method for adding an image watermark according to claim 1, characterized in that, The step of determining the second target feature based on the pixel grayscale values ​​of the second region image and the watermark image includes: The image of the second region is divided into regions according to a preset size to obtain the target region; The texture complexity and embedding capacity of the target region are calculated based on the pixel grayscale values, height, and width of the target region. The watermark clarity of the target region is calculated based on the texture complexity and embedding capacity. The second target feature is calculated based on the pixel grayscale values ​​of the target region and the pixel grayscale values ​​of the watermark corresponding to the watermark clarity.

11. An apparatus for adding an image watermark, characterized in that, The device includes: The acquisition module is used to acquire the image to be processed and the watermark image; The segmentation module is used to segment the image to be processed according to the image type of the image region to obtain the segmented region; The determining module is configured to, when the divided region includes a first region, extract features from the image of the first region and the watermark image to obtain high-frequency features and low-frequency features of the image of the first region and the watermark image respectively; fuse the high-frequency features of the image of the first region and the watermark image and the low-frequency features of the image of the first region and the watermark image respectively to obtain fused high-frequency features and fused low-frequency features; determine the first target feature corresponding to the fused high-frequency features and fused low-frequency features according to the relationship between the high-frequency features, low-frequency features and target features, and obtain the target first region image corresponding to the first target feature; wherein the high-frequency features are features whose feature values ​​exceed a set threshold, and the low-frequency features are features whose feature values ​​do not exceed a set threshold. The determining module is further configured to, when the region includes a second region, determine a second target feature based on the pixel grayscale values ​​of the image of the second region and the pixel grayscale values ​​of the watermark image, and obtain a target second region image corresponding to the second target feature; The step of dividing the image to be processed into regions according to the image type of the image region to obtain the divided regions includes: Gradient features are extracted from the image to be processed, and a feature vector matrix is ​​generated based on the extracted gradient features, wherein the gradient features represent the image type. Based on the eigenvector values ​​of the eigenvector matrix, the image to be processed is divided into regions to obtain the divided regions of the image to be processed.

12. A terminal device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the image watermarking method as described in any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the image watermarking method as described in any one of claims 1-10.

Citation Information

Patent Citations

  • Watermark embedding and extracting method and device, computer equipment and storage medium

    CN112801846A

  • Robust and stealthy video watermarking

    US20020172394A1