[go: up one dir, main page]

CN112017097B - Watermark adding method, watermark adding device, terminal and computer readable storage medium - Google Patents

Watermark adding method, watermark adding device, terminal and computer readable storage medium Download PDF

Info

Publication number
CN112017097B
CN112017097B CN202010879760.XA CN202010879760A CN112017097B CN 112017097 B CN112017097 B CN 112017097B CN 202010879760 A CN202010879760 A CN 202010879760A CN 112017097 B CN112017097 B CN 112017097B
Authority
CN
China
Prior art keywords
watermark
blocks
channel image
value
watermarking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010879760.XA
Other languages
Chinese (zh)
Other versions
CN112017097A (en
Inventor
彭杰
苏文凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haowei Technology Wuhan Co ltd
Original Assignee
Haowei Technology Wuhan Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Haowei Technology Wuhan Co ltd filed Critical Haowei Technology Wuhan Co ltd
Priority to CN202010879760.XA priority Critical patent/CN112017097B/en
Publication of CN112017097A publication Critical patent/CN112017097A/en
Application granted granted Critical
Publication of CN112017097B publication Critical patent/CN112017097B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application discloses a watermark adding method, a watermark adding device, a terminal and a computer readable storage medium, wherein the watermark adding method comprises the steps of obtaining a first channel image, performing DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks forming the first channel image, selecting M watermark blocks from the N DCT blocks according to a random sequence, then performing watermark intensity calculation on the M watermark blocks to obtain watermark intensity of each watermark block, and performing watermark adding on the M watermark blocks according to the watermark intensity of each watermark block to obtain a watermark image. By implementing the method and the device, the problems that watermarks in a high-frequency area and a low-frequency area are easy to see and the like in the prior art can be solved.

Description

Watermark adding method, watermark adding device, terminal and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a watermark adding method, device, terminal, and computer readable storage medium.
Background
The digital watermarking technology is a leading edge technology of data security protection developed in recent years, plays an important role in the fields of data copyright protection, use tracking, integrity verification and the like, and is increasingly widely applied.
Currently, watermarking schemes are based on discrete cosine (Discrete Cosine Transform, DCT) transforms to add watermarks. Specifically, the terminal firstly performs binary coding on watermark information, then performs DCT transformation on the original image, adds the coded watermark information at a specific position, then performs DCT inverse transformation, and finally outputs a watermark image with watermark. However, in practice, it is found that the above scheme is prone to too strong watermark in the high frequency boundary region, and the low frequency region is prone to be visible before and after the JPEG compression of the image, affecting the invisibility of the watermark.
Disclosure of Invention
The embodiment of the application provides a watermark adding method, a watermark adding device, a watermark adding terminal and a watermark adding computer readable storage medium, which can solve the problems that in the existing scheme, too strong watermark appears in a high-frequency boundary area, the watermark is visible after the compression of a low-frequency area and the like.
In a first aspect, a watermarking method is provided, including: the terminal acquires a first channel image, and performs discrete cosine DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks and N positive integers which form the first channel image. And selecting M watermark blocks from the N DCT blocks according to the random sequence, wherein the watermark blocks refer to DCT blocks with watermark information to be added. Then, watermark intensity calculation is carried out on the M watermark blocks, so that watermark intensity of each watermark block is obtained; and finally, according to the watermark intensity of each watermark block, carrying out watermark adding on M watermark blocks to obtain a watermark image.
In some embodiments, the calculating the watermark strength of the M watermark segments to obtain the watermark strength of each watermark segment includes: calculating global frequency domain intensity of the M watermark blocks according to the median value of the frequency domain value differences of two positions to be added in the M watermark blocks, wherein the positions to be added are positions for adding watermark information in the watermark blocks; and calculating the watermark strength of each of the M watermark blocks according to the global frequency domain strength.
In some embodiments, the watermark strength P of the ith watermark partition of the M watermark partitions i The method comprises the following steps:
P i =D i ×G=|F xi -F yi |×G
wherein F is xi 、F yi And the frequency domain value of the position to be added is the global frequency domain intensity, and the frequency domain values of the two positions to be added are different.
In some embodiments, the global frequency domain intensity G is:
m is the median value of the frequency domain values of the positions to be added in the M watermark blocks, a is a preset intensity parameter, and b is a preset scaling parameter.
In some embodiments, said watermarking of said M watermark segments according to watermark strength of each said watermark segment comprises: and if the watermark intensity of the target block is greater than or equal to a first threshold value, carrying out watermark adding on the target block according to the watermark intensity of the target block, wherein the target block is any one of the M watermark blocks.
In some embodiments, said watermarking of said M watermark segments according to watermark strength of each said watermark segment comprises: acquiring a median value of a middle frequency band of a target block, wherein the median value of the middle frequency band is a median value of a frequency domain value of the middle frequency band of the target block; if the median value of the intermediate frequency of the target block is greater than or equal to a second threshold value, watermarking the target block according to the watermark strength of the target block; the target block is any one of the M watermark blocks.
In some embodiments, if the number of target blocks with the median value greater than or equal to the second threshold exceeds the third threshold, watermarking the target blocks with the median value greater than or equal to the second threshold according to the watermark intensity of the target blocks with the median value greater than or equal to the second threshold, and outputting a corresponding watermark image, wherein the watermark image comprises DCT blocks with watermarks and DCT blocks without watermarks.
In some embodiments, the method further comprises: performing DCT inverse transformation on the watermark image to obtain a second channel image; gray level inspection is carried out on the first channel image and the second channel image to obtain a relative change value, wherein the relative change value is used for reflecting the difference between the second channel image and the first channel image; and watermarking the first channel image according to the relative change value.
In some embodiments, the watermarking the first channel image according to the relative change value comprises: and if the relative change value is greater than or equal to a corresponding threshold value, performing watermark intensity weakening addition on the first channel image or not performing watermark addition on the first channel image.
In some embodiments, the relative change values include a maximum relative change value, max (delta), and/or an average relative change value, mean (delta),
V=min(I in ,I out )
d=|I in -I out |;
wherein B is a preset smoothing factor, I in For the first channel image, I out For the second channel image, max () is the maximum function and mean () is the average function.
In a second aspect, there is provided a watermarking apparatus operable to perform the method of the first aspect or any of the alternative embodiments of the first aspect. The functions can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more units corresponding to the functions described above. The unit may be software and/or hardware.
In a third aspect, there is provided a terminal comprising: a processor and a memory coupled to the processor; wherein the memory includes computer readable instructions; the processor is configured to execute the computer readable instructions in the memory to cause the vehicle to perform the arrangement of the first aspect or any of the alternative embodiments of the first aspect.
In a fourth aspect, there is provided a computer program product which, when run on a computer, causes the computer to perform the method of the first aspect or any of the alternative embodiments of the first aspect.
In a fifth aspect, a chip product is provided, performing the method of the first aspect or any of the alternative embodiments of the first aspect.
In a sixth aspect, a computer readable storage medium is provided, having instructions stored therein, which when run on a computer, cause the computer to perform the method of the first aspect or any of the alternative embodiments of the first aspect.
Drawings
Fig. 1 is a schematic flow chart of a watermarking method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a DCT partition provided in the present application.
Fig. 3 is a schematic structural diagram of a watermarking apparatus according to an embodiment of the present application.
Fig. 4 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
Specific embodiments of the present application are described in further detail below with reference to the accompanying drawings.
In order to solve the problems that in the prior art, the watermark in the high-frequency area is too strong, the low-frequency area is easily visible after image compression, and the like, the application provides a watermark adding method, a device, a terminal and a computer readable storage medium, wherein the method is applicable to. Fig. 1 is a schematic flow chart of a watermarking method provided in the present application. The method shown in fig. 1 comprises the following steps:
s101, a terminal acquires a first channel image, and performs discrete cosine DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks.
The terminal can acquire an original image to be processed, and the original image can be a red, green and blue RGB image. The terminal extracts a first channel image from the RGB image, which may be a combination of any one or more of an R channel image, a G channel image, or a B channel image. In practical applications, the first channel image is preferably a B-channel image, since the user is particularly sensitive to blue B-channel images.
After the terminal acquires the first channel image, DCT transformation can be performed on the first channel image to obtain N DCT blocks of 8 x 8. Alternatively, the terminal may number each DCT partition sequentially, 1,2,3, … … N, respectively.
S102, selecting M watermark blocks from N DCT blocks according to a random sequence, wherein the random sequence is obtained based on a key value key, and the watermark blocks refer to DCT blocks with watermark information to be added. M is a positive integer less than or equal to N.
The terminal can randomly obtain a random sequence with the length of N according to the key value input by a user, then sequences the random sequence from large to small, extracts the positions of the previous M numbers in the original random sequence, and takes DCT blocks corresponding to the positions as watermark blocks to be added with watermark information. Wherein, M is determined by watermark information to be added, and M may specifically be a length of a binary sequence obtained by binary encoding the watermark information.
And S103, performing watermark intensity calculation on the M watermark blocks to obtain the watermark intensity of each watermark block.
In one example, the terminal may calculate global frequency domain intensities of the M watermark blocks according to a median value of frequency domain value differences of two positions to be added in the M watermark blocks, where the positions to be added are positions where watermark information is added in the watermark blocks. And then calculating the watermark strength of each of the M watermark blocks according to the global frequency domain strength.
Referring to FIG. 2, a schematic diagram of DCT partitioning is shown. As in fig. 2, the region of all 0 in the upper left corner may be referred to as a low band, the region of 1 in the DCT block may be referred to as a medium band, and the region of all 0 in the lower right corner may be referred to as a high band. In FIG. 2, the positions of the two 1's marked with circles are the watermark information to be added in the DCTThe position (xi, yi) of the message to be added. The position of the position to be added in the DCT partition can be specifically set by system customization, which is not limited in this application. The frequency domain values corresponding to the positions to be added are respectively recorded as F xi 、F yi . The terminal will F xi -F yi Denoted as D i D is i =|F xi -F yi | a. The invention relates to a method for producing a fibre-reinforced plastic composite. The terminal can calculate global frequency domain intensity G of M watermark blocks according to the median value (S) of the frequency domain values of the positions to be added in the M watermark blocks, and the specific G is calculated and obtained according to the following formula (1):
wherein S is the median of the frequency domain values of the positions to be added of all the blocks in the M watermark blocks, namely D is calculated in all the blocks i Is a median value of (c). a is a preset intensity parameter, and b is a preset scaling parameter. The a and the b can be experience values set by a user according to experience, or numerical values set by a system in a self-defining way, and the application is not limited.
After the global frequency domain intensity G is obtained, the terminal may further calculate the watermark intensities of the M watermark segments according to the frequency domain values of the G and the positions to be added of the M watermark segments. Taking the ith watermark block as an example, the watermark strength P of the ith watermark block i =D i ×G=|F xi -F yi |×G。
S104, adding the watermark to the M watermark blocks according to the watermark intensity of each watermark block to obtain a watermark image.
According to the watermark adding method and the watermark adding terminal, the watermark adding can be correspondingly carried out on the M watermark blocks according to the watermark strength of the M watermark blocks, so that the watermark image is obtained. Specifically, the terminal firstly performs binary coding on watermark information to obtain a binary coding sequence, and the length of the binary coding sequence is M. And the terminal adds M binary codes into M watermark blocks according to the corresponding watermark strength. The specific process of watermark information addition is not described in detail herein.
In one example, the terminal blocks according to the targetAnd (5) watermark strength, namely adding the watermark to the target block. The target block is any one of M watermark blocks. Specifically, if the watermark strength P of the target block d Beyond (greater than or equal to) the first threshold, the terminal will watermark the target block according to the watermark strength of the target block. Conversely, if the watermark strength P of the target block d And if the watermark is smaller than the first threshold, the terminal does not watermark the target block. I.e. no watermark information is added to the target block. The first threshold is set by the system in a custom manner, for example, 0.5.
In yet another example, the terminal may obtain a median of frequency values of the target partitions, the median being a median of frequency values of the frequency bands in the target partitions. The terminal may determine whether to watermark the target block according to the mid-frequency median of the target block. Specifically, if the median value of the intermediate frequency of the target block exceeds (is greater than or equal to) the second threshold value, watermarking can be performed on the target block according to the watermark strength of the target block. Otherwise, if the median value of the target block is smaller than the second threshold (e.g., 0.001), the target block may be determined to be a low-frequency region of the image, and the terminal does not watermark the target block. So as to exclude partial low-frequency domain or near-pure color unsuitable for adding watermark, ensure that the watermark is still invisible after JPEP compression, and increase the invisibility of the image in the low-frequency region.
In yet another example, if the number of target blocks with a median frequency value less than the second threshold (i.e., without watermarking) exceeds a certain threshold, then no watermarking is performed on the M watermark blocks. For example, if the number of target blocks to which no watermark is added exceeds 0.15 times that of all the blocks, the terminal does not watermark the first channel image. Otherwise, if the number of the target blocks with the median value larger than or equal to the second threshold exceeds the third threshold, that is, if the number of the target blocks to which the watermark is added is larger, the terminal continues to perform the step of adding the watermark to the target blocks according to the watermark strength of the target blocks. At this time, the terminal may perform watermark adding on the target blocks with the median value greater than or equal to the second threshold value according to the watermark strength of the target blocks with the median value greater than or equal to the second threshold value, and output a corresponding watermark image, where the watermark image includes a DCT block with a watermark added and a DCT block without a watermark added.
In yet another example, the terminal may also exclude that the high frequency region watermark is too strong. Specifically, the terminal performs DCT inverse transformation on the watermark image to obtain a second channel image. The terminal performs gray level inspection on the first channel image and the second channel image to obtain a relative change amount, wherein the relative change amount is used for reflecting the difference between the second channel image and the first channel image; the first channel image is then watermarked according to the relative change values. The relative change values include a maximum relative change value of f1=max (delta) and/or an average relative change value of f2=mean (delta). Where max refers to the maximum function and mean refers to the average function.
V=min(I in ,I out )
d=|I in -I out |;
Wherein B is a preset smoothing factor. I in The first channel image may specifically refer to a gray value of a DCT block in the first channel image. I out The second channel image may specifically refer to a gray value of a DCT block in the second channel image.
Taking the case that the relative change value is the maximum relative change value F1 and the average relative change value F2 as an example, if the maximum relative change value F1 is greater than or equal to the fourth threshold (e.g. 0.4) and the average relative change value F2 is greater than or equal to the fifth threshold (e.g. 0.05), the terminal may perform watermark strength reducing addition on the first channel image, for example, watermark addition is performed on the first channel image only according to half of the watermark strength, and the steps related to the image watermark addition may be specifically referred to the steps S101 to S104 described above, except that the watermark strength is reduced by half and the watermark strength is not repeated herein. Or directly without watermarking the first channel image, etc. So as to avoid the watermark in the high frequency area being too strong and increase the invisibility of the high frequency boundary area. Otherwise, directly outputting a second channel image, wherein the second channel image is an image formed by adding the watermark to the first channel image.
The fourth threshold and the fifth threshold are both thresholds set by the system in a self-defining way, and can also be experience values set by a user according to experience.
Through implementing the application, the terminal acquires the first channel image, and performs discrete cosine DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks forming the first channel image, wherein N is a positive integer. And selecting M watermark blocks from the N DCT blocks according to a random sequence, wherein the random sequence is obtained based on a key value key, the watermark blocks are DCT blocks to be added with watermark, and M is a positive integer less than or equal to N. And performing watermark intensity calculation on the M watermark blocks to obtain watermark intensity of each watermark block, and performing watermark adding on the M watermark blocks according to the watermark intensity of each watermark block to obtain a watermark image. In this way, the watermark in the high-frequency area is prevented from being too strong, so that the watermark is easy to see, and the invisibility of the watermark is prevented from being influenced.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a watermarking apparatus provided in the present application. The watermarking apparatus 300 as shown in fig. 3 comprises an acquisition unit 301, a selection unit 302, a calculation unit 303 and an adding unit 304. Wherein,
the acquiring unit 301 is configured to acquire a first channel image, and perform discrete cosine DCT on the first channel image to obtain N DCT blocks that form the first channel image, where N is a positive integer;
the selecting unit 302 is configured to select M watermark blocks from the N DCT blocks according to a random sequence, where the random sequence is obtained based on a key value key, the watermark blocks are DCT blocks to be watermarked, and M is a positive integer less than or equal to N;
the calculating unit 303 is configured to calculate watermark intensities of the M watermark blocks, so as to obtain watermark intensity of each watermark block;
the adding unit 304 is configured to add watermarks to the M watermark blocks according to the watermark strength of each watermark block, so as to obtain a watermark image.
In some embodiments, the calculating unit 303 is specifically configured to calculate global frequency domain intensities of the M watermark blocks according to a median value of frequency domain values of positions to be added in the M watermark blocks, where the positions to be added are positions where watermark information is added in the watermark blocks; and calculating the watermark strength of each of the M watermark blocks according to the global frequency domain strength.
In some embodiments, the watermark strength P of the ith watermark partition of the M watermark partitions i The method comprises the following steps: p (P) i =D i ×G=|F xi -F yi I x G. Wherein F is xi 、F yi The frequency domain value for the position to be added and G is the global frequency domain intensity.
In some embodiments, the global frequency domain intensity G is:
wherein S is the median value of the frequency domain values of the positions to be added in the M watermark blocks, a is a preset intensity parameter, and b is a preset scaling parameter.
In some embodiments, the adding unit 304 is specifically configured to watermark the target block according to the watermark strength of the target block if the watermark strength of the target block is greater than or equal to the first threshold, where the target block is any one of the M watermark blocks.
In some embodiments, the adding unit 304 is further configured to obtain a median value of the intermediate frequency domain values of the target blocks, where the median value of the intermediate frequency domain values is a median value of the intermediate frequency domain values of the target blocks; if the median value of the intermediate frequency of the target block is greater than or equal to a second threshold value, watermarking the target block according to the watermark strength of the target block; the target block is any one of the M watermark blocks.
In some embodiments, the adding unit 304 is further configured to not perform the step of watermarking the target block according to the watermark strength of the target block if the number of target blocks with the mid-frequency value smaller than the second threshold exceeds a third threshold.
In some embodiments, the apparatus further comprises a transformation unit 305 and an inspection unit 306. The transforming unit 305 is configured to perform DCT inverse transformation on the watermark image to obtain a second channel image; the inspection unit 306 is configured to perform gray level inspection on the first channel image and the second channel image, so as to obtain a relative change value, where the relative change value is used to reflect a difference between the second channel image and the first channel image; the adding unit 304 is further configured to watermark the first channel image according to the relative change value.
In some embodiments, the adding unit 304 is specifically configured to perform watermark strength reduction adding on the first channel image or not perform watermark adding on the first channel image if the relative change value is greater than or equal to a fourth threshold value.
In some embodiments, the relative change values include a maximum relative change value, max (delta), and/or an average relative change value, mean (delta),
V=min(I in ,I out )
d=|I in -I out |;
wherein B is a preset smoothing factor, I in For the first channel image, I out For the second channel image, max () is the maximum function and mean () is the average function.
By implementing the method, the terminal can adaptively acquire the watermark strength of the watermark blocks, and watermark addition is carried out on the watermark blocks according to the watermark strength, so that the watermark is not obvious in a low-frequency area, and the robustness is high in a high-frequency area. In addition, partial low-frequency area or near-pure-color area is not suitable for adding watermark, so that watermark is still invisible after JPEG compression, and watermark invisibility of high-frequency area and low-frequency area is increased.
Fig. 4 is a schematic structural diagram of a terminal according to an embodiment of the present application. The terminal 400 as shown in fig. 4 includes: at least one input device 401; at least one output device 402; at least one processor 403, such as a CPU; and a memory 404, the input device 401, the output device 402, the processor 403, and the memory 404 being connected by a bus 405.
The input device 401 may be a touch panel of a mobile terminal, including a touch screen and a touch screen, and is configured to detect an operation instruction on the touch panel of the terminal.
The output device 402 may be a display screen of a mobile terminal, and is used for outputting and displaying information.
The memory 404 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as a disk memory. The memory 404 is used for storing a set of program codes, and the input device 401, the output device 402, and the processor 403 are used for calling the program codes stored in the memory 404, and performing the following operations:
acquiring a first channel image, and performing discrete cosine DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks forming the first channel image, wherein N is a positive integer;
selecting M watermark blocks from the N DCT blocks according to a random sequence, wherein the random sequence is obtained based on a key value key, the watermark blocks are DCT blocks to be added with watermarks, and M is a positive integer less than or equal to N;
performing watermark intensity calculation on the M watermark blocks to obtain watermark intensity of each watermark block;
and adding the watermark to the M watermark blocks according to the watermark strength of each watermark block to obtain a watermark image.
In some embodiments, the calculating the watermark strength of the M watermark segments to obtain the watermark strength of each watermark segment includes:
calculating global frequency domain intensity of the M watermark blocks according to the median value of frequency domain values of positions to be added in the M watermark blocks, wherein the positions to be added are positions for adding watermark information in the watermark blocks;
and calculating the watermark strength of each of the M watermark blocks according to the global frequency domain strength.
In some embodiments, the watermark strength P of the ith watermark partition of the M watermark partitions i The method comprises the following steps: p (P) i =D i ×G=|F xi -F yi I x G, wherein F xi 、F yi The frequency domain value for the position to be added and G is the global frequency domain intensity.
In some embodiments, the global frequency domain intensity G is:
wherein S is the median value of the frequency domain values of the positions to be added in the M watermark blocks, a is a preset intensity parameter, and b is a preset scaling parameter.
In some embodiments, said watermarking of said M watermark segments according to watermark strength of each said watermark segment comprises: and if the watermark intensity of the target block is greater than or equal to a first threshold value, carrying out watermark adding on the target block according to the watermark intensity of the target block, wherein the target block is any one of the M watermark blocks.
In some embodiments, said watermarking of said M watermark segments according to watermark strength of each said watermark segment comprises:
acquiring a median value of a middle frequency band of a target block, wherein the median value of the middle frequency band is a median value of a frequency domain value of the middle frequency band of the target block;
if the median value of the intermediate frequency of the target block is greater than or equal to a second threshold value, watermarking the target block according to the watermark strength of the target block; the target block is any one of the M watermark blocks.
In some embodiments, the processor 403 is further configured to not perform the step of watermarking the target block according to the watermark strength of the target block if the number of target blocks having a median of the intermediate frequency values less than the second threshold exceeds a third threshold.
In some embodiments, the processor 403 is further configured to perform DCT inverse transform on the watermark image to obtain a second channel image; gray level inspection is carried out on the first channel image and the second channel image to obtain a relative change value, wherein the relative change value is used for reflecting the difference between the second channel image and the first channel image; and watermarking the first channel image according to the relative change value.
In some embodiments, the processor 403 is further configured to watermark the first channel image with or without watermark strength reduction if the relative change value is greater than or equal to a fourth threshold.
In some embodiments, the relative change values include a maximum relative change value, max (delta), and/or an average relative change value, mean (delta),
V=min(I in ,I out )
d=|I in -I out |;
wherein B is a preset smoothing factor, I in For the first channel image, I out For the second channel image, max () is the maximum function and mean () is the average function.
Based on the same inventive concept, the principle of solving the problem by the terminal provided in the embodiments of the present application is similar to that of solving the problem by the terminal in the embodiments of the method of the present application, so that the implementation of each device may refer to the implementation of the method, and for brevity, a description is not repeated here.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and for those portions of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The modules in the terminal equipment of the embodiment of the invention can be combined, divided and deleted according to actual needs.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of watermarking, the method comprising:
acquiring a first channel image, and performing discrete cosine DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks forming the first channel image, wherein N is a positive integer;
selecting M watermark blocks from the N DCT blocks according to a random sequence, wherein the random sequence is obtained based on a key value key, the watermark blocks are DCT blocks to be added with watermarks, and M is a positive integer less than or equal to N;
performing watermark intensity calculation on the M watermark blocks to obtain watermark intensity of each watermark block;
according to the watermark intensity of each watermark block, carrying out watermark adding on the M watermark blocks to obtain a watermark image;
the step of calculating the watermark strength of the M watermark blocks, and the step of obtaining the watermark strength of each watermark block comprises the following steps:
calculating global frequency domain intensity of the M watermark blocks according to the median value of the frequency domain value differences of two positions to be added in the M watermark blocks, wherein the positions to be added are positions for adding watermark information in the watermark blocks;
calculating the watermark strength of each of the M watermark blocks according to the global frequency domain strength;
the watermarking of the M watermark segments according to the watermark strength of each watermark segment comprises:
acquiring a median value of a middle frequency band of a target block, wherein the median value of the middle frequency band is a median value of a frequency domain value of the middle frequency band of the target block;
if the median value of the intermediate frequency of the target block is greater than or equal to a second threshold value, watermarking the target block according to the watermark strength of the target block; the target block is any one of the M watermark blocks;
and if the number of the target blocks with the median value larger than or equal to the second threshold exceeds a third threshold, watermarking the target blocks with the median value larger than or equal to the second threshold according to the watermark intensity of the target blocks with the median value larger than or equal to the second threshold, and outputting corresponding watermark images, wherein the watermark images comprise DCT blocks added with watermarks and DCT blocks not added with watermarks.
2. The watermarking method according to claim 1, wherein the watermark strength P of an i-th watermark block of the M watermark blocks i The method comprises the following steps:
P i =D i ×G=|F xi -F yi |×G
wherein F is xi 、F yi For the frequency domain value of the position to be added, G is the global frequency domain intensity, D i And the frequency domain values of the two positions to be added are different.
3. The watermarking method according to claim 1 or 2, wherein the global frequency domain strength G is:
wherein S is the median value of the frequency domain values of the positions to be added in the M watermark blocks, a is a preset intensity parameter, and b is a preset scaling parameter.
4. The watermarking method according to claim 1, wherein watermarking the M watermark segments according to watermark strength of each of the watermark segments comprises:
and if the watermark intensity of the target block is greater than or equal to a first threshold value, carrying out watermark adding on the target block according to the watermark intensity of the target block, wherein the target block is any one of the M watermark blocks.
5. The watermarking method according to claim 1, wherein after watermarking the M watermark blocks, the method further comprises:
performing DCT inverse transformation on the watermark image to obtain a second channel image;
gray level inspection is carried out on the first channel image and the second channel image to obtain a relative change value, wherein the relative change value is used for reflecting the difference between the second channel image and the first channel image;
and watermarking the first channel image according to the relative change value.
6. The watermarking method according to claim 5, wherein watermarking the first channel image according to the relative change value comprises:
and if the relative change value is greater than or equal to a corresponding threshold value, performing watermark intensity weakening addition on the first channel image or not performing watermark addition on the first channel image.
7. Watermarking method according to claim 5 or 6, characterized in that the relative change values comprise a maximum relative change value max (delta) and/or an average relative change value mean (delta),
V=min(I in ,I out )
d=|I in -I out |;
wherein B is a preset smoothing factor, I in For the first channel image, I out For the second channel image, max () is the maximum function and mean () is the average function.
8. A watermarking apparatus, characterized in that the watermarking apparatus comprises: the device comprises an acquisition unit, a selection unit, a calculation unit and an addition unit, wherein:
the acquisition unit is used for acquiring a first channel image, performing discrete cosine DCT (discrete cosine transformation) on the first channel image to obtain N DCT blocks forming the first channel image, wherein N is a positive integer;
the selecting unit is used for selecting M watermark blocks from the N DCT blocks according to a random sequence, wherein the random sequence is obtained based on a key value key, the watermark blocks are DCT blocks needing to be added with watermarks in the N DCT blocks, and M is a positive integer smaller than N;
the computing unit is used for computing the watermark intensity of the M watermark blocks to obtain the watermark intensity of each watermark block;
the adding unit is used for adding the watermark to the M watermark blocks according to the watermark strength of each watermark block to obtain a watermark image;
the computing unit is specifically configured to compute global frequency domain intensities of the M watermark blocks according to a median value of frequency domain values of positions to be added in the M watermark blocks, where the positions to be added are positions where watermark information is added in the watermark blocks; calculating the watermark strength of each of the M watermark blocks according to the global frequency domain strength;
the adding unit is specifically configured to obtain a median value of a middle frequency domain value of the target block, where the median value of the middle frequency domain value is a median value of a middle frequency domain value of the target block; if the median value of the intermediate frequency of the target block is greater than or equal to a second threshold value, watermarking the target block according to the watermark strength of the target block; the target block is any one of the M watermark blocks; and if the number of the target blocks with the median value larger than or equal to the second threshold exceeds a third threshold, watermarking the target blocks with the median value larger than or equal to the second threshold according to the watermark intensity of the target blocks with the median value larger than or equal to the second threshold, and outputting corresponding watermark images, wherein the watermark images comprise DCT blocks added with watermarks and DCT blocks not added with watermarks.
9. A terminal comprising a processor and a memory coupled to the processor, wherein the memory comprises computer readable instructions, and wherein the processor is configured to execute the computer readable instructions in the memory to implement the watermarking method according to any of claims 1-7.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the watermarking method according to any of claims 1-7.
CN202010879760.XA 2020-08-27 2020-08-27 Watermark adding method, watermark adding device, terminal and computer readable storage medium Active CN112017097B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010879760.XA CN112017097B (en) 2020-08-27 2020-08-27 Watermark adding method, watermark adding device, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010879760.XA CN112017097B (en) 2020-08-27 2020-08-27 Watermark adding method, watermark adding device, terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112017097A CN112017097A (en) 2020-12-01
CN112017097B true CN112017097B (en) 2024-03-08

Family

ID=73503755

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010879760.XA Active CN112017097B (en) 2020-08-27 2020-08-27 Watermark adding method, watermark adding device, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112017097B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806697B (en) * 2021-09-22 2023-09-01 北京明朝万达科技股份有限公司 Watermark adding method and system in proxy mode
CN113822786B (en) * 2021-11-25 2022-02-22 成都盛思睿信息技术有限公司 Invisible digital image watermarking processing method and device with strong robustness

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455578A (en) * 2003-05-10 2003-11-12 合肥工业大学 Image waterprint method for copyright protection
CN101004831A (en) * 2007-01-25 2007-07-25 北京大学 Methof for embedding and extracting watermark based on statistical model of coefficient in transform domain of digital images
CN101042769A (en) * 2007-01-12 2007-09-26 中国人民解放军国防科学技术大学 Active mode digital image content identification method based on wavelet and DCT dual domain
CN103295184A (en) * 2013-05-13 2013-09-11 西安电子科技大学 Frequency domain and airspace combined halftone watermarking method
CN103559676A (en) * 2013-10-11 2014-02-05 西安电子科技大学 Method for preventing color image blind watermarking from being printed and scanned based on DCT coefficient statistical property
CN103955879A (en) * 2014-04-11 2014-07-30 杭州电子科技大学 DWT-SVD robust blind watermark method based on multilevel DCT

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW545061B (en) * 2002-01-25 2003-08-01 Univ Nat Central Method for embedding and extracting of watermark in image compression system, and the embedded hardware structure

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455578A (en) * 2003-05-10 2003-11-12 合肥工业大学 Image waterprint method for copyright protection
CN101042769A (en) * 2007-01-12 2007-09-26 中国人民解放军国防科学技术大学 Active mode digital image content identification method based on wavelet and DCT dual domain
CN101004831A (en) * 2007-01-25 2007-07-25 北京大学 Methof for embedding and extracting watermark based on statistical model of coefficient in transform domain of digital images
CN103295184A (en) * 2013-05-13 2013-09-11 西安电子科技大学 Frequency domain and airspace combined halftone watermarking method
CN103559676A (en) * 2013-10-11 2014-02-05 西安电子科技大学 Method for preventing color image blind watermarking from being printed and scanned based on DCT coefficient statistical property
CN103955879A (en) * 2014-04-11 2014-07-30 杭州电子科技大学 DWT-SVD robust blind watermark method based on multilevel DCT

Non-Patent Citations (9)

* Cited by examiner, † Cited by third party
Title
Secure spread spectrum watermarking for multimedia;COX I.J.等;IEEE Transactions on Image Processing;第6卷(第12期);1673-1687 *
Towards robust and hidden image copyright labeling;Koch, E.等;In IEEE Workshop on Nonlinear Signal and Image Processing(第01期);123-132 *
一种基于视觉掩盖的数字图像水印技术;曹岭, 杨小帆, 柏森;重庆大学学报(自然科学版)(第06期);64-67 *
一种鲁棒的基于DCT域的数字水印方案研究;杨华春;;微计算机信息;20090625(第18期);49-51 *
基于HVS的自适应盲水印算法;轩璐;;安阳工学院学报;20150720(第04期);35-40 *
基于分块DCT的自适应扩频水印算法;饶智坚;常建平;科技广场;20051231(第005期);9-14 *
基于变换域和HVS的数字水印算法研究;江营;周萍;;微计算机信息(第21期);64-66 *
基于离散余弦变换的矢量地图水印算法研究;于涛;《信息科技辑》(第06期);第16-19、34-37页 *
基于置乱变换的DCT域二维数字水印算法;高海洋;朱桂斌;柏森;代勤芳;;科技信息(学术版)(第03期);18-20 *

Also Published As

Publication number Publication date
CN112017097A (en) 2020-12-01

Similar Documents

Publication Publication Date Title
Chen et al. High payload steganography mechanism using hybrid edge detector
CN109948307B (en) Reversible data hiding method based on pixel multi-scale prediction
JP5654434B2 (en) Method and apparatus for embedding watermark image in host image
CN107688731B (en) Digital watermarking algorithm based on text document protection
CN110232650B (en) Color image watermark embedding method, detection method and system
CN112017097B (en) Watermark adding method, watermark adding device, terminal and computer readable storage medium
Lin et al. Application of grey-relational analysis to find the most suitable watermarking scheme
CN111107370B (en) Video watermark embedding processing method and device, electronic equipment and storage medium
JP2001203878A (en) Device and method for processing image
CN104766269A (en) Spread transform dither modulation watermarking method based on JND brightness model
CN105160619B (en) A kind of image watermark detection method
NZ565552A (en) Embedding bits into segmented regions of an image based on statistical features
CN114626967A (en) A digital watermark embedding and extraction method, device, equipment and storage medium
Jiang et al. Adaptive spread transform QIM watermarking algorithm based on improved perceptual models
CN103093127B (en) Method and system of dynamic copyright protection based on sudoku and multiple digital watermarks
Watni et al. A comparative evaluation of jpeg steganography
CN118587077A (en) Reversible steganographic method, system and electronic device based on frequency domain image information hiding
Zhang et al. A robust and high-efficiency blind watermarking method for color images in the spatial domain
CN115482142A (en) Dark watermark adding method, extracting method, system, storage medium and terminal
US20080226118A1 (en) System and method for watermarking data
Al-Gindy et al. Watermarking of colour images in the DCT domain using Y channel
CN1552043A (en) MPEG-2 decoder with an embedded contrast enhancement function and methods therefor
Al-Gindy et al. A novel blind Image watermarking technique for colour RGB images in the DCT domain using green channel
CN111754379B (en) Digital watermark processing method and device, electronic equipment and storage medium
Hsieh et al. Protecting Copyrights of Color Images using a Watermarking Scheme Based on Secret Sharing and Wavelet Transform.

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant