Method and device for adding watermark, and electronic device
By processing the watermark with noise in different directions and levels, and combining it with Fourier transform technology to add invisible watermarks, the problem of low anti-theft coefficient of watermarks in the existing technology is solved, and the anti-theft properties of the image and the concealment of invisible watermarks are improved. .
Patent Information
- Application Number
- CN201910647176.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-17
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2039-07-26
AI Technical Summary
The anti-theft coefficient of the watermark adding scheme in the existing technology is low, and it is easy to be deleted in batches, affecting the copyright protection of the image.
By performing noise processing on the watermark in different directions and different levels of noise processing in the same direction, a variety of watermark styles are obtained, and the pixel values of the preset area are superimposed on the pixel values of the image. Through Fourier transform and inverse Fourier Leaf processing adds invisible watermarks to improve image theft resistance.
It effectively prevents watermarks from being deleted in batches, improves the anti-theft coefficient of images, reduces the impact of watermarks on image quality, and increases the concealment and robustness of invisible watermarks.
Smart Images

Figure CN110458746B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a method for adding a watermark, an apparatus for adding a watermark, and an electronic device for implementing the method for adding a watermark. Background Art
[0002] In order to declare the copyright information of the image, a watermark is usually added to the image without affecting the image content.
[0003] Specifically, marking information (such as patterns, text, letters, and data) used to declare the copyright information of an image is used as a watermark. Further, the watermark is added to the image to form an image containing the watermark.
[0004] However, the watermark adding solution provided by the related art has a low anti-theft coefficient.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0006] The purpose of the present disclosure is to provide a method for adding watermarks, an apparatus for adding watermarks, and an electronic device, thereby overcoming to a certain extent the problem of low anti-theft coefficient of watermark adding solutions in related technologies.
[0007] According to a first aspect of the present disclosure, a method for adding a watermark is provided, the method comprising: performing noise processing in different directions on a first watermark to obtain a plurality of watermark patterns, and performing noise processing at different levels in the same direction on the first watermark to obtain one or more of the plurality of watermark patterns; obtaining first pixel values of preset areas of the plurality of watermark patterns, and obtaining second pixel values of a first image to be watermarked; and superimposing the first pixel values and the second pixel values to obtain a plurality of types of second images, wherein different types of second images contain different watermark patterns.
[0008] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the noise processing of the first watermark in different directions is performed to obtain multiple watermark patterns, including: obtaining a noise image in a first direction with the same size as the first watermark, and obtaining a noise image in a second direction with the same size as the first watermark, wherein the first direction and the second direction have an angle; performing Gaussian filtering on the noise image to obtain a first-direction noise image and a second-direction noise image; performing pixel perturbation on the first watermark in a first direction using the first-direction noise image to obtain a first watermark pattern; performing pixel perturbation on the first watermark in a second direction using the second-direction noise image to obtain a second watermark pattern.
[0009] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the first watermark is subjected to noise processing of different levels in the same direction to obtain multiple watermark patterns, including: determining the pixel displacement of the first noise image according to the first noise level, and determining the pixel displacement of the second noise image according to the second noise level; performing pixel perturbation on the first watermark through the first noise image to obtain a third watermark pattern; and performing pixel perturbation on the first watermark through the second noise image to obtain a fourth watermark pattern.
[0010] In an exemplary embodiment of the present disclosure, based on the above embodiment, the first noise image, the second noise image and the first watermark have the same size.
[0011] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the performing noise processing on the first watermark in different directions includes: performing noise processing on the marked area in the first watermark in different directions; the performing noise processing on the first watermark at different levels in the same direction includes: performing noise processing on the marked area in the first watermark at different levels in the same direction.
[0012] In an exemplary embodiment of the present disclosure, based on the above embodiment, obtaining the first pixel value of the preset area of the multiple watermark patterns includes: determining the pixel value of the marked area of the multiple watermark patterns as the first pixel value.
[0013] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the superimposing of the first pixel value and the second pixel value to obtain multiple types of second images includes: determining a first weight of the pixel value in the target watermark pattern and determining a second weight of the second pixel value based on the grayscale value of the alpha channel of the target watermark pattern; and superimposing the pixel value in the target watermark pattern and the second pixel value based on the first weight and the second weight to obtain a second image containing the target pattern.
[0014] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, after obtaining multiple types of second images, the method further includes: obtaining a spectrum diagram of the second image through Fourier transform processing; encoding the second watermark to obtain an encoded watermark; adding the encoded watermark to the spectrum diagram; and obtaining a third image containing an invisible watermark through inverse Fourier transform processing.
[0015] According to a second aspect of the present disclosure, a device for adding a watermark is provided, the device comprising: a noise processing module, configured to perform noise processing in different directions on a first watermark to obtain a plurality of watermark patterns, and to perform noise processing at different levels in the same direction on the first watermark to obtain one or more of the plurality of watermark patterns; a pixel value acquisition module, configured to obtain a first pixel value of a preset area of the plurality of watermark patterns, and to obtain a second pixel value of a first image to be watermarked; and a watermark adding module, configured to superimpose the first pixel value and the second pixel value to obtain a plurality of types of second images, wherein different types of second images contain different watermark patterns.
[0016] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the above-mentioned noise processing module is specifically configured to: obtain a noise image in a first direction with the same size as the first watermark, and obtain a noise image in a second direction with the same size as the first watermark, wherein the first direction and the second direction have an angle; perform Gaussian filtering on the noise image to obtain a first-direction noise image and a second-direction noise image; perform pixel perturbation on the first watermark in a first direction through the first-direction noise image to obtain a first watermark pattern; perform pixel perturbation on the first watermark in a second direction through the second-direction noise image to obtain a second watermark pattern.
[0017] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the above-mentioned noise processing module is specifically configured to: determine the pixel displacement of the first noise image according to the first noise level, and determine the pixel displacement of the second noise image according to the second noise level; perform pixel perturbation on the first watermark through the first noise image to obtain a third watermark pattern; and perform pixel perturbation on the first watermark through the second noise image to obtain a fourth watermark pattern.
[0018] In an exemplary embodiment of the present disclosure, based on the above embodiment, the first noise image, the second noise image and the first watermark have the same size.
[0019] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the noise processing module is specifically configured to: perform noise processing in different directions on the marked area in the first watermark; and perform noise processing of different levels in the same direction on the marked area in the first watermark.
[0020] In an exemplary embodiment of the present disclosure, based on the above embodiment, the noise processing module is specifically configured to: determine the pixel value of the marking area of the multiple watermark patterns as the first pixel value.
[0021] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the above-mentioned watermark adding module is specifically configured to: determine a first weight of a pixel value in the target watermark pattern according to the grayscale value of the alpha channel of the target watermark pattern, and determine a second weight of the second pixel value; based on the first weight and the second weight, superimpose the pixel value in the target watermark pattern and the second pixel value to obtain a second image containing the target pattern.
[0022] In an exemplary embodiment of the present disclosure, based on the above embodiment, the device for adding watermarks further includes: a blind watermark module.
[0023] The above-mentioned blind watermark module is configured to: after obtaining multiple types of second images, obtain a spectrum diagram of the second image through Fourier transform processing; encode the second watermark to obtain an encoded watermark; add the encoded watermark to the spectrum diagram; and obtain a third image containing an invisible watermark through inverse Fourier transform processing.
[0024] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for adding a watermark as described in any embodiment of the first aspect is implemented.
[0025] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method for adding watermarks described in any embodiment of the first aspect above by executing the executable instructions.
[0026] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:
[0027] In the method for adding watermarks provided in an example embodiment of the present disclosure, noise disturbances can be applied to a watermark in the following manners: applying noise disturbances in different directions, or applying noise disturbances of different levels in the same direction, or applying noise disturbances of different levels in different directions, thereby obtaining different styles of the above-mentioned watermarks. Among them, different watermark styles can be used to be added to a first image to obtain a second image. On the one hand, the present technical solution can avoid batch watermark removal of images through different watermark styles, thereby improving the anti-theft coefficient of the image. On the other hand, in the present technical solution, the first pixel value of a preset area (such as a logo area) of different watermark styles is obtained to be superimposed with the second pixel value of the first image, so as to specifically add the logo area in the watermark to the first image, which is beneficial to reduce the impact of the watermark on the image quality of the first image.
[0028] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0030] Figure 1 A schematic diagram showing an exemplary system architecture of a method and apparatus for adding watermarks according to an embodiment of the present disclosure is shown;
[0031] Figure 2 The following schematically shows a flow chart of a method for adding a watermark according to an embodiment of the present disclosure;
[0032] Figure 3 The following schematically shows a flow chart of a method for obtaining multiple watermark patterns according to an embodiment of the present disclosure;
[0033] Figure 4 Schematically shows a flow chart of a method for obtaining multiple watermark patterns according to another embodiment of the present disclosure;
[0034] Figure 5 A schematic diagram schematically illustrates a process of processing a first watermark using noise images with different noise levels in an embodiment of the present disclosure;
[0035] Figure 6 A schematic diagram schematically illustrates a process of processing a first watermark using noise images with different noise levels in another embodiment of the present disclosure;
[0036] Figure 7 The following schematically shows a flow chart of a method for adding a watermark according to an embodiment of the present disclosure;
[0037] Figure 8 The following schematically shows a flow chart of a method for adding a watermark according to an embodiment of the present disclosure;
[0038] Figure 9 Schematically shows a flow chart of a method for adding watermarks according to another embodiment of the present disclosure;
[0039] Figure 10 The following schematically shows a flow chart of a method for adding a watermark according to another embodiment of the present disclosure;
[0040] Figure 11The following schematically shows a structural diagram of a device for adding watermarks according to an embodiment of the present disclosure;
[0041] Figure 12 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or that other methods, components, devices, steps, etc. may be employed. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0043] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0044] Figure 1 A schematic diagram shows a system architecture of an exemplary application environment in which a method and apparatus for adding watermarks according to an embodiment of the present disclosure can be applied.
[0045] like Figure 1 As shown, the system architecture 100 may include one or more terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as needed. For example, the server 105 may be a server cluster consisting of multiple servers.
[0046] The watermarking method provided in the embodiment of the present disclosure is generally executed by the server 105, and accordingly, the watermarking device is generally provided in the server 105. However, it is easy for those skilled in the art to understand that the watermarking method provided in the embodiment of the present disclosure can also be executed by the terminal devices 101, 102, and 103, and accordingly, the watermarking device can also be provided in the terminal devices 101, 102, and 103, and this is not particularly limited in this exemplary embodiment.
[0047] For example, in an exemplary embodiment, the terminal devices 101, 102, and 103 may send the first watermark and the first image to the server 105, so that the server 105 performs noise processing in different directions on the first watermark to obtain multiple watermark styles, and performs noise processing of different levels in the same direction on the first watermark to obtain one or more of the multiple watermark styles, and obtains the first pixel value of the preset area of the multiple watermark styles, and obtains the second pixel value of the first image to be watermarked, and further, superimposes the first pixel value and the second pixel value to obtain multiple types of second images, wherein different types of second images contain different watermark styles. Exemplarily, the server 105 sends the above-mentioned different types of second images to the terminal devices 101, 102, and 103, and the terminal devices 101, 102, and 103 can display the above-mentioned second images.
[0048] Related art watermarking solutions typically apply the same watermark to all images. However, by comparing multiple images, we can estimate the watermark and its transparency, ultimately enabling batch removal. Alternatively, we can manually remove watermarks using tools like Photoshop.
[0049] In response to one or more problems in the related art, the present disclosure provides a method, apparatus, computer-readable storage mechanism, and electronic device for adding watermarks. By subjecting a watermark to different noise perturbations to obtain multiple watermark patterns, these patterns are then added to an image to obtain an image containing the different watermark patterns. This avoids estimating the watermark or its transparency by comparing multiple images, thereby preventing the wholesale deletion of watermarks from images and improving the image's theft resistance.
[0050] The technical solutions of the embodiments of the present disclosure are described in detail below:
[0051] Figure 2The flowchart of the method for adding watermark according to an embodiment of the present disclosure is schematically shown. Figure 2 , the embodiment shown in the figure includes:
[0052] Step S210: performing noise processing in different directions on the first watermark to obtain multiple watermark patterns, and performing noise processing in different levels in the same direction on the first watermark to obtain one or more of the multiple watermark patterns;
[0053] Step S220, obtaining first pixel values of the preset areas of the plurality of watermark patterns, and obtaining second pixel values of the first image to be watermarked; and
[0054] Step S230: Superimpose the first pixel value and the second pixel value to obtain multiple types of second images, wherein different types of second images contain different watermark patterns.
[0055] exist Figure 2 In the technical solution provided by the illustrated embodiment, noise disturbances can be applied to a watermark in the following ways: applying noise disturbances in different directions, or applying noise disturbances of different levels in the same direction, or applying noise disturbances of different levels in different directions, thereby obtaining different styles of the above-mentioned watermarks. Among them, different watermark styles can be used to be added to a first image to obtain a second image. On the one hand, the present technical solution can avoid batch watermark removal of images through different watermark styles, thereby improving the anti-theft coefficient of the image. On the other hand, in the present technical solution, the first pixel value of a preset area (such as a logo area) of different watermark styles is obtained to be superimposed with the second pixel value of the first image, thereby specifically adding the logo area in the watermark to the first image, which is beneficial to reducing the impact of the watermark on the image quality of the first image.
[0056] The following Figure 2 The specific implementation of each step in the embodiment shown is described in detail:
[0057] In an exemplary embodiment, the first watermark refers to an image containing marking information, where the marking information is used to declare copyright information of the image.
[0058] In an exemplary embodiment, for a first watermark A, different patterns of the first watermark A are obtained [A1, A2, A3, …, An], and the different patterns of the first watermark A are added to a first image S to obtain different types of second images [S+A1, S+A2, S+A3, …, S+An]. It can be seen that different types of second images contain different watermark patterns. However, in the related art, the watermarked image obtained can be expressed as [S+A, S+A, S+A, …, S+A]. Compared to the related art, this technical solution avoids the need to compare multiple images to estimate the watermark or its transparency, thereby preventing the batch deletion of watermarks from images and improving the image's anti-theft coefficient.
[0059] In an exemplary embodiment, different patterns of the first watermark are obtained by applying noise perturbation to the first watermark. Exemplarily, the noise perturbation is pixel-level noise perturbation to improve the accuracy of the noise perturbation control of the watermark. Exemplarily, the noise perturbation is applied to a predetermined area of the first watermark (e.g., the logo area) to minimize the impact of the noise perturbation on the watermark.
[0060] In a specific implementation of noise processing, the first watermark can be processed with noise in different directions to obtain multiple watermark patterns. For example, Figure 3 The flowchart of the method for obtaining multiple watermark patterns according to an embodiment of the present disclosure is schematically shown. Figure 3 The embodiment shown in the figure includes steps S310 to S340.
[0061] In step S310, a noise image in a first direction with the same size as the first watermark is obtained, and a noise image in a second direction with the same size as the first watermark is obtained, wherein the first direction and the second direction have an angle.
[0062] In an exemplary embodiment, the noise image is set to have the same size as the first watermark. Then, when the first watermark is subjected to noise processing through the noise image, the noise image and the first watermark can be conveniently aligned, thereby accurately achieving noise perturbation of the first watermark through the noise image.
[0063] In an exemplary embodiment, the maximum noise value in the noise image is the maximum displacement of the pixel. For example, to ensure the beauty of the watermark, the maximum displacement of the pixel max_move can be determined by the designer or based on empirical values after a large number of experiments.
[0064] In step S320, the noise image is subjected to Gaussian filtering to obtain a first directional noise image and a second directional noise image.
[0065] In an exemplary embodiment, the noise image can be smoothed to a certain extent by Gaussian filtering, so that the noise image after Gaussian filtering can be used to perform noise processing on the first watermark, which is conducive to reducing the impact on the aesthetics of the first watermark. The kernel parameters of the Gaussian filter can be adjusted according to different scenarios.
[0066] In step S330, pixels of the first watermark are perturbed in a first direction using the first directional noise image to obtain a first watermark pattern; and in step S340, pixels of the first watermark are perturbed in a second direction using the second directional noise image to obtain a second watermark pattern.
[0067] In an exemplary embodiment, the first direction may be the X-axis direction, and the second direction may be the Y-axis direction. Thus, the noise image in the first direction may generate noise perturbations in the X-axis direction for the pixels in the first watermark, and the noise image in the second direction may generate noise perturbations in the Y-axis direction for the pixels in the first watermark.
[0068] exist Figure 3 In the illustrated embodiment, noise perturbations are performed on the first watermark in different directions respectively, thereby obtaining a plurality of watermark patterns subjected to noise perturbations in different directions.
[0069] In another specific embodiment of noise processing, the first watermark can be subjected to noise processing in the same direction but at different levels to obtain multiple watermark patterns. For example, Figure 4 The flowchart of the method for obtaining multiple watermark patterns according to another embodiment of the present disclosure is schematically shown. Figure 4 The embodiment shown in the figure includes steps S410 to S430.
[0070] In step S410 , pixel displacement of a first noise image is determined according to a first noise level, and pixel displacement of a second noise image is determined according to a second noise level.
[0071] In an exemplary embodiment, the noise levels applied during the noise processing process can be divided into different levels. Noise images with different noise levels have different pixel displacements, thereby varying the degree of noise disturbance to the watermark. For example, in this embodiment, the noise levels are divided into a first noise level and a second noise level. The pixel displacement of the first noise image is determined based on the first noise level, and the pixel displacement of the second noise image is determined based on the second noise level.
[0072] In step S420, pixels of the first watermark are perturbed using the first noise image to obtain a third watermark pattern; and in step S430, pixels of the first watermark are perturbed using the second noise image to obtain a fourth watermark pattern.
[0073] In an exemplary embodiment, the first noise image is used to generate noise disturbance of a first noise level on the pixels in the first watermark, and the second noise image is used to generate noise disturbance of a second noise level on the pixels in the first watermark.
[0074] exist Figure 4 In the illustrated embodiment, the first watermark is subjected to noise disturbances in the same direction but at different levels, thereby obtaining a plurality of watermark patterns subjected to noise disturbances at different levels.
[0075] For example, Figure 5 and Figure 6 The process of processing the first watermark B by using noise images with different noise levels is shown.
[0076] refer to Figure 5 , an image 511 with a first noise level in the X-axis direction, and an image 512 with a first noise level in the Y-axis direction, perform noise processing on the watermark B to obtain a watermark pattern 53. Figure 6 , an image 611 with noise at the second noise level in the X-axis direction, and an image 612 with noise at the second noise level in the Y-axis direction, are used to perform noise processing on watermark B to obtain a watermark pattern 63. It can be seen that different watermark patterns can be obtained by noise processing at different noise levels.
[0077] In an exemplary embodiment, referring to Figure 7 For the multiple watermark patterns 72 obtained according to the above embodiment, by adding the multiple watermark patterns 72 to the original image (i.e., the first image) 71, multiple types of second images 73 can be obtained, wherein different types of second images 73 contain different watermark patterns 731.
[0078] For example, continue to refer to Figure 2 After obtaining multiple watermark patterns, execute step S220 to obtain the first pixel value of the preset area of the multiple watermark patterns, and obtain the second pixel value of the first image to be watermarked; and execute step S230 to superimpose the first pixel value and the second pixel value to obtain multiple types of second images, wherein different types of second images contain different watermark patterns.
[0079] In an exemplary embodiment, Figure 8 The flowchart of the method for adding watermark according to an embodiment of the present disclosure is schematically shown. Figure 8 , the embodiment shown in the figure includes:
[0080] Step S810: Determine a first weight of a pixel value in a target watermark pattern and a second weight of a second pixel value based on the grayscale value of the alpha channel of the target watermark pattern; and, step S820: Superimpose the pixel value in the target watermark pattern and the second pixel value based on the first weight and the second weight to obtain a second image containing the target pattern.
[0081] In an exemplary embodiment, based on the alpha channel of the watermarked image, a weight is calculated for each pixel in the watermarked image and a weight is calculated for each pixel in the first image (i.e., the original image). The product of each pixel in the watermarked image and the first weight is then summed with the product of the corresponding pixel in the first image and the second weight. This determines the pixel value at the corresponding position in the second image, thereby determining the watermarked second image. To protect key information in the first image (i.e., the original image) while maintaining aesthetics, this embodiment supports adding the watermark to the first image by transmitting key pixel locations.
[0082] In an exemplary embodiment, after obtaining the above-mentioned second image containing different watermark patterns, this embodiment also provides a technical solution for further improving the anti-theft coefficient by means of invisible watermarks (ie, blind watermarks). Figure 9 The flowchart of the method for adding watermark according to another embodiment of the present disclosure is schematically shown. Figure 9 The embodiment shown in the figure includes steps S910 to S940.
[0083] In step S910, a frequency spectrum of the second image is obtained through Fourier transform processing.
[0084] In an exemplary embodiment, referring to Figure 10 For the second image 1001 obtained in step S230, a fast Fourier transform process is performed in step S1010 to obtain a spectrum diagram 1002 of the second image.
[0085] Among them, Fast Fourier Transform (FFT) is a fast algorithm of Discrete Fourier Transform (FFT). It is obtained by improving the Discrete Fourier Transform algorithm based on the odd, even, imaginary and real characteristics of Discrete Fourier Transform.
[0086] In an exemplary embodiment, the Fourier transform function dft() provided by OpenCV can be used to implement the fast Fourier transform of the second image 1001. By using the FFT method, the second image 1001 is decomposed into sine components and cosine components, thereby obtaining a spectrum diagram of the second image.
[0087] In step S920, the second watermark is encoded to obtain an encoded watermark; and in step S930, the encoded watermark is added to the spectrum graph.
[0088] In an exemplary embodiment, referring to Figure 10 The second watermark can be the same as the first watermark, or it can be a watermark that has undergone the aforementioned noise processing. For example, to prevent concentrated interference in a certain frequency domain of the spectrogram from reducing the aesthetics of the image or the concealment of the blind watermark (for example, concentrating in the upper left corner of the image will cause concentrated changes in low frequencies, thereby affecting pixels in the original image where the color remains essentially unchanged), this embodiment encodes the second watermark to obtain an encoded watermark. The encoded watermark is then distributed to the spectrogram in step S1020, resulting in a spectrogram 1003 after the encoded watermark is added.
[0089] In an exemplary embodiment, if the second watermark (e.g., JPG format) affects the format of the image frequency domain during compression, the blind watermark is strengthened in this embodiment. Since the concealment and robustness of blind watermarks are mutually exclusive, the strength of the blind watermark can be an empirical value obtained through multiple experiments.
[0090] In step S940, a third image containing the invisible watermark is obtained by performing an inverse Fourier transform process.
[0091] In an exemplary embodiment, referring to Figure 10 In step S1030, the spectrum graph 1003 after adding the coded watermark is subjected to inverse Fourier transform processing to obtain a third image 1004 containing the invisible watermark.
[0092] Through the above embodiment, while avoiding batch deletion of visible watermarks in images, the anti-theft coefficient can be further improved by using blind watermarks that are not easily detected by the naked eye.
[0093] Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments can be implemented as a computer program executed by a processor (including a CPU and a GPU). For example, the GPU can be used to perform noise processing on the first watermark to obtain multiple watermark patterns, and the CPU or GPU can be used to implement the addition of multiple watermark patterns to the first image. When executed by the processor, the computer program performs the functions defined in the above method provided in this disclosure. The program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
[0094] Furthermore, it should be noted that the aforementioned figures are merely illustrative of the processes included in the methods according to exemplary embodiments of the present disclosure and are not intended to be limiting. It is readily understood that the processes illustrated in the aforementioned figures do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0095] Furthermore, in this exemplary embodiment, a device for adding a watermark is also provided. Figure 11 As shown, the watermark adding device 1100 includes: a noise processing module 1101, a pixel value acquisition module 1102 and a watermark adding module 1103.
[0096] The above-mentioned noise processing module 1101 is configured to perform noise processing in different directions on the first watermark to obtain multiple watermark styles, and to perform noise processing of different levels in the same direction on the first watermark to obtain one or more of the multiple watermark styles; the above-mentioned pixel value acquisition module 1102 is configured to obtain the first pixel value of the preset area of the multiple watermark styles, and to obtain the second pixel value of the first image to be watermarked; the above-mentioned watermark adding module 1103 is configured to superimpose the first pixel value and the second pixel value to obtain multiple types of second images, wherein different types of second images contain different watermark styles.
[0097] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the above-mentioned noise processing module 1101 is specifically configured to: obtain a noise image in a first direction with the same size as the first watermark, and obtain a noise image in a second direction with the same size as the first watermark, wherein the first direction and the second direction have an angle; perform Gaussian filtering on the noise image to obtain a first-direction noise image and a second-direction noise image; perform pixel perturbation on the first watermark in a first direction through the first-direction noise image to obtain a first watermark pattern; perform pixel perturbation on the first watermark in a second direction through the second-direction noise image to obtain a second watermark pattern.
[0098] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the noise processing module 1101 is specifically configured to: determine the pixel displacement of the first noise image according to the first noise level, and determine the pixel displacement of the second noise image according to the second noise level; perform pixel perturbation on the first watermark through the first noise image to obtain a third watermark pattern; and perform pixel perturbation on the first watermark through the second noise image to obtain a fourth watermark pattern.
[0099] In an exemplary embodiment of the present disclosure, based on the above embodiment, the first noise image, the second noise image and the first watermark have the same size.
[0100] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the noise processing module 1101 is specifically configured to: perform noise processing in different directions on the marked area in the first watermark; and perform noise processing of different levels in the same direction on the marked area in the first watermark.
[0101] In an exemplary embodiment of the present disclosure, based on the above embodiment, the noise processing module 1101 is specifically configured to: determine the pixel value of the marking area of the multiple watermark patterns as the first pixel value.
[0102] In an exemplary embodiment of the present disclosure, based on the aforementioned embodiment, the watermark adding module 1103 is specifically configured to: determine a first weight of a pixel value in the target watermark pattern according to the grayscale value of the alpha channel of the target watermark pattern, and determine a second weight of the second pixel value; based on the first weight and the second weight, superimpose the pixel value in the target watermark pattern and the second pixel value to obtain a second image containing the target pattern.
[0103] In an exemplary embodiment of the present disclosure, based on the above embodiment, the watermarking device 1100 further includes: a blind watermark module.
[0104] The above-mentioned blind watermark module is configured to: after obtaining multiple types of second images, obtain a spectrum diagram of the second image through Fourier transform processing; encode the second watermark to obtain an encoded watermark; add the encoded watermark to the spectrum diagram; and obtain a third image containing an invisible watermark through inverse Fourier transform processing.
[0105] The specific details of each module or unit in the above-mentioned watermarking device have been described in detail in the corresponding watermarking method, so they will not be repeated here.
[0106] Figure 12 A schematic structural diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present invention is shown.
[0107] It should be noted that Figure 12 The computer system 1200 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0108] like Figure 12As shown, the computer system 1200 includes a processor 1201, wherein the processor 1201 may include: a graphics processing unit (GPU), a central processing unit (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203. Various programs and data required for system operation are also stored in the RAM 1203. The processor (GPU / CPU) 1201, ROM 1202 and RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0109] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output section 12012 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 1208 including a hard disk; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. Removable media 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1210 as needed, so that computer programs read from the removable media can be installed in the storage section 1208 as needed.
[0110] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the processor (GPU / CPU) 1201, the various functions defined in the system of the present application are performed. In some embodiments, the computer system 1200 may also include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
[0111] It should be noted that the computer-readable medium shown in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0112] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, and the units described may also be provided in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0114] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device implements the method described in the above embodiments.
[0115] For example, the electronic device can implement Figure 2 As shown in: step S210, performing noise processing on the first watermark in different directions to obtain multiple watermark patterns, and performing noise processing on the first watermark at different levels in the same direction to obtain one or more of the multiple watermark patterns; step S220, obtaining first pixel values of preset areas of the multiple watermark patterns, and obtaining second pixel values of the first image to be watermarked; and step S230, superimposing the first pixel values and the second pixel values to obtain multiple types of second images, wherein different types of second images contain different watermark patterns.
[0116] For example, the electronic device can achieve the following Figures 3 to 10 The steps shown in .
[0117] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0118] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0119] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0120] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for adding a watermark, It is characterized in that The method comprises: Performing noise processing in different directions on the first watermark to obtain multiple watermark patterns, and / or performing noise processing in different levels on the same direction on the first watermark to obtain multiple watermark patterns; Acquire a first pixel value of a preset area of the obtained multiple watermark patterns, and acquire a second pixel value of a first image to be watermarked; The first pixel value and the second pixel value are superimposed to obtain multiple types of second images, wherein different types of second images contain different watermark patterns.
2. The method for adding a watermark according to claim 1, It is characterized in that The first watermark is subjected to noise processing in different directions to obtain a plurality of watermark patterns, including: Acquire a noise image in a first direction with the same size as the first watermark, and acquire a noise image in a second direction with the same size as the first watermark, wherein the first direction and the second direction have an angle; Performing Gaussian filtering on the noise image to obtain a first direction noise image and a second direction noise image; Performing pixel perturbations in a first direction on the first watermark using the first directional noise image to obtain a first watermark pattern; The first watermark is perturbed in a second direction by using the second directional noise image to obtain a second watermark pattern.
3. The method for adding watermark according to claim 1, It is characterized in that The first watermark is subjected to noise processing of different levels in the same direction to obtain multiple watermark patterns, including: determining a pixel displacement of a first noise image according to a first noise level, and determining a pixel displacement of a second noise image according to a second noise level; Perform pixel perturbation on the first watermark by using the first noise image to obtain a third watermark pattern; The first watermark is perturbed by pixels using the second noise image to obtain a fourth watermark pattern.
4. The method for adding a watermark according to claim 3, It is characterized in that The first noise image, the second noise image, and the first watermark have the same size.
5. The method for adding watermark according to any one of claims 1 to 4, It is characterized in that The performing noise processing on the first watermark in different directions includes: Performing noise processing in different directions on the marked area in the first watermark; The performing noise processing of different levels on the first watermark in the same direction includes: The marked area in the first watermark is subjected to noise processing of different levels in the same direction.
6. The method for adding watermark according to any one of claims 1 to 4, It is characterized in that The obtaining of the first pixel value of the preset area of the obtained multiple watermark patterns includes: Determine that the pixel value of the marking area of the plurality of watermark patterns is the first pixel value.
7. The method for adding a watermark according to claim 6, It is characterized in that The step of superimposing the first pixel value and the second pixel value to obtain a plurality of types of second images includes: determining a first weight of a pixel value in the target watermark pattern according to a grayscale value of an alpha channel of the target watermark pattern, and determining a second weight of the second pixel value; Based on the first weight and the second weight, the pixel value in the target watermark pattern and the second pixel value are superimposed to obtain a second image containing the target watermark pattern.
8. The method for adding watermark according to any one of claims 1 to 4, It is characterized in that After obtaining the second images of multiple types, the method further includes: Obtaining a frequency spectrum of the second image through Fourier transform processing; encoding the second watermark to obtain an encoded watermark; adding the encoded watermark to the spectrogram; Through inverse Fourier transform processing, a third image containing the invisible watermark is obtained.
9. A device for adding a watermark, It is characterized in that The device comprises: a noise processing module, configured to perform noise processing in different directions on the first watermark to obtain multiple watermark patterns, and / or to perform noise processing in different levels in the same direction on the first watermark to obtain multiple watermark patterns; A pixel value acquisition module is configured to acquire a first pixel value of a preset area of the obtained multiple watermark patterns, and to acquire a second pixel value of the first image to be watermarked; The watermark adding module is configured to superimpose the first pixel value and the second pixel value to obtain multiple types of second images, wherein different types of second images contain different watermark styles.
10. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method for adding watermarks according to any one of claims 1 to 8 by executing the executable instructions.
11. A computer readable medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method for adding watermarks according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Method for embedding and extracting watermark in digital image
CN101866478A
Electronic watermark embedding apparatus, electronic watermark detection device, methods thereof, and programs thereof
JP2009100296A
