CN111107370B - Video watermark embedding processing method and device, electronic equipment and storage medium - Google Patents

Video watermark embedding processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111107370B
CN111107370B CN201911415147.6A CN201911415147A CN111107370B CN 111107370 B CN111107370 B CN 111107370B CN 201911415147 A CN201911415147 A CN 201911415147A CN 111107370 B CN111107370 B CN 111107370B
Authority
CN
China
Prior art keywords
watermark
frame image
component
embedding
centroid
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
CN201911415147.6A
Other languages
Chinese (zh)
Other versions
CN111107370A (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.)
Galaxy Internet Tv Co ltd
Original Assignee
Galaxy Internet Tv 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 Galaxy Internet Tv Co ltd filed Critical Galaxy Internet Tv Co ltd
Priority to CN201911415147.6A priority Critical patent/CN111107370B/en
Publication of CN111107370A publication Critical patent/CN111107370A/en
Application granted granted Critical
Publication of CN111107370B publication Critical patent/CN111107370B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • H04N19/467Embedding additional information in the video signal during the compression process characterised by the embedded information being invisible, e.g. watermarking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component

Abstract

The embodiment of the invention discloses an embedding processing method and device of video watermark, electronic equipment and a storage medium, wherein the method comprises the following steps: decoding an original video file to obtain single-frame images in YUV forms; separating Y, U, V components for each single-frame image in YUV form; acquiring a watermark embedding position of the Y component; and sequentially and circularly embedding all the characters of the watermark character string into the watermark embedding positions of the Y components of the single-frame images, synthesizing the watermark embedding positions with the original U, V components into target single-frame images in a YUV form, and finally encoding and outputting all the target single-frame images into target video files. By the method, the watermark embedding positions of the single-frame images are different, so that the robustness of resisting geometric attacks of watermark information is improved; meanwhile, different watermark characters are embedded into each single-frame image, so that the method can resist multiple encoding operations, enhancement processing, frame extraction processing and the like, and is low in calculation complexity and high in calculation speed.

Description

Video watermark embedding processing method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a video watermark embedding processing method and device, electronic equipment and a storage medium.
Background
The embedding technology of the digital watermark information is to hide specific digital watermark information in multimedia contents (video, audio and image) by using different embedding methods, and the digital watermark information has good watermark invisibility and user imperceptibility.
According to the embedding mode of the digital watermark, the digital watermark embedding technology can be divided into two types based on a space domain and a frequency domain. The digital watermarking method based on the spatial domain is to embed watermark information on the pixel value of an image directly. The digital watermarking method based on the frequency domain is to embed watermark information in a transform domain after discrete Fourier transform or wavelet transform or discrete cosine transform.
However, the existing spatial domain-based video watermark embedding method has poor robustness against geometric attacks, and the frequency domain-based video watermark embedding method has poor capability of resisting contrast enhancement.
Disclosure of Invention
Because the existing methods have the above problems, embodiments of the present invention provide a method and an apparatus for embedding a video watermark, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present invention provides a method for embedding a video watermark, including:
decoding an original video file to obtain single-frame images in YUV forms;
for each single-frame image in the YUV form, Y, U, V components of the current single-frame image are separated;
acquiring a watermark embedding position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
sequentially and circularly embedding each character of the watermark character string into the watermark embedding position of each single-frame image Y component;
synthesizing the Y component of each single-frame image embedded with the watermark and the original U, V component into a target single-frame image in a YUV form;
and all target single-frame images are encoded and output as a target video file.
Optionally, the watermark embedding position is a four-neighborhood of a centroid of a maximum connected domain of a Y component of a current single frame image, and the calculation of the four-neighborhood of the centroid specifically includes:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000021
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
Optionally, the watermark string is a binary string, and includes a start string and a watermark information string;
correspondingly, the sequentially and circularly embedding each character sequence of the watermark character string into the watermark embedding position of each single-frame image Y component specifically includes:
sequentially embedding each character of the starting character string into the watermark embedding position of each single-frame image Y component;
sequentially embedding each character of the watermark information character string into the watermark embedding position of the Y component of each single-frame image from the next single-frame image;
circularly embedding the characters of the starting character string and the watermark information character string into the watermark embedding positions of the Y components of the single-frame images in sequence until the watermark embedding positions of the Y components of all the single-frame images are embedded with watermark characters;
and the watermark embedding position of each single-frame image Y component is embedded into only one bit in the watermark character string.
Optionally, the sequentially and cyclically embedding each character of the watermark character string into the watermark embedding position of each single-frame image Y component specifically includes:
calculating the pixel value img (i, j) of the watermark embedding position (i, j) of each single-frame image Y component as follows:
Figure BDA0002351001590000031
Figure BDA0002351001590000032
mean=(org(i,j-1)+org(i+1,j-1)+org(i+1,j))/3
wherein org (i, j) is a pixel value before the watermark information is embedded into the coordinates (i, j); and flag is a character to be embedded in the watermark character string, off is an offset of a pixel value, and mean is an average value of pixel values of three neighborhoods of org (i, j-1), org (i +1, j-1) and org (i +1, j).
Optionally, the video watermark embedding processing method further includes:
decoding the target video file to be detected to obtain single-frame images in YUV forms;
for each single-frame image in the YUV form, Y, U, V components of the current single-frame image are separated;
acquiring a watermark extraction position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
sequentially extracting characters of the watermark extraction position of each single-frame image Y component, and waiting to enter a watermark detection formula, wherein if a first preset number of character strings continuously output by the watermark detection formula are the starting character strings, a subsequent second preset number of character strings continuously output by the watermark detection formula are watermark information character strings;
and if the at least one group of extracted watermark information character strings is judged to be matched with the embedded watermark information character strings, determining that the watermark detection is successful.
Optionally, the watermark extraction positions are four neighborhoods of a centroid of a maximum connected domain of a Y component of a current single-frame image, and the calculation of the four neighborhoods of the centroid specifically includes:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000041
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
Optionally, the watermark detection formula is:
Figure BDA0002351001590000042
mean=(img(i,j-1)+img(i+1,j-1)+img(i+1,j))/3
flag=flag(x,y+1)||flag(x-1,y)||flag(x+1,y)||flag(x,y-1)
the method comprises the following steps that img (i, j) is a pixel value of a pixel point (i, j) after watermark information is embedded, mean is an average value of pixel values of three neighborhoods org (i, j-1), org (i +1, j-1) and org (i +1, j) of org (i, j), and flag (i, j) is a pixel value of each pixel point in four neighborhoods; and flag is an output value of the watermark detection formula.
In a second aspect, an embodiment of the present invention further provides an apparatus for embedding a video watermark, including:
the video decoding module is used for decoding the original video file to obtain single-frame images in YUV forms;
the component separation module is used for separating Y, U, V components of the current single-frame image aiming at each single-frame image in the YUV form;
the position acquisition module is used for acquiring the watermark embedding position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
the watermark embedding module is used for sequentially and circularly embedding all the characters of the watermark character string into the watermark embedding positions of the Y components of all the single-frame images;
the component synthesis module is used for synthesizing the Y component of each single-frame image embedded with the watermark and the original U, V component into a target single-frame image in a YUV form;
and the video coding module is used for coding and outputting all target single-frame images into a target video file.
Optionally, the watermark embedding position is a four-neighborhood of a centroid of a maximum connected domain of a Y component of a current single frame image, and the calculation of the four-neighborhood of the centroid specifically includes:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000051
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
Optionally, the watermark string is a binary string, and includes a start string and a watermark information string;
accordingly, the watermark embedding module is specifically configured to:
sequentially embedding each character of the starting character string into the watermark embedding position of each single-frame image Y component;
sequentially embedding each character of the watermark information character string into the watermark embedding position of the Y component of each single-frame image from the next single-frame image;
and circularly embedding the characters of the starting character string and the watermark information character string into the watermark embedding positions of the Y components of the single-frame images until the watermark embedding positions of the Y components of all the single-frame images are embedded with the watermark characters.
Optionally, the watermark embedding position of each single-frame image Y component is embedded in only one bit of the watermark string.
Optionally, the watermark embedding module is specifically configured to:
calculating the pixel value img (i, j) of the watermark embedding position (i, j) of each single-frame image Y component as follows:
Figure BDA0002351001590000061
Figure BDA0002351001590000062
mean=(org(i,j-1)+org(i+1,j-1)+org(i+1,j))/3
wherein org (i, j) is a pixel value before the watermark information is embedded into the coordinates (i, j); and flag is a character to be embedded in the watermark character string, off is an offset of a pixel value, and mean is an average value of pixel values of three neighborhoods of org (i, j-1), org (i +1, j-1) and org (i +1, j).
Optionally, the video watermark embedding processing apparatus further includes:
the video secondary decoding module is used for decoding the target video file to be detected to obtain single-frame images in YUV forms;
the component secondary separation module is used for separating Y, U, V components of the current single-frame image aiming at each single-frame image in the YUV form;
the position secondary acquisition module is used for acquiring the watermark extraction position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
the watermark detection module is used for sequentially extracting the characters at the watermark extraction position of each single-frame image Y component in sequence and waiting to enter a watermark detection formula, and if the first preset number of character strings continuously output by the watermark detection formula are the starting character strings, the subsequent second preset number of character strings continuously output by the watermark detection formula are watermark information character strings;
and the detection success determining module is used for determining that the watermark detection is successful if at least one group of extracted watermark information character strings is matched with the embedded watermark information character strings.
Optionally, the watermark extraction positions are four neighborhoods of a centroid of a maximum connected domain of a Y component of a current single-frame image, and the calculation of the four neighborhoods of the centroid specifically includes:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000071
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
Optionally, the watermark detection formula is:
Figure BDA0002351001590000081
mean=(img(i,j-1)+img(i+1,j-1)+img(i+1,j))/3
flag=flag(x,y+1)||flag(x-1,y)||flag(x+1,y)||flag(x,y-1)
the method comprises the following steps that img (i, j) is a pixel value of a pixel point (i, j) after watermark information is embedded, mean is an average value of pixel values of three neighborhoods org (i, j-1), org (i +1, j-1) and org (i +1, j) of org (i, j), and flag (i, j) is a pixel value of each pixel point in four neighborhoods; and flag is an output value of the watermark detection formula.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
at least one processor; and
at least one memory communicatively coupled to the processor, wherein:
the memory stores program instructions executable by the processor, which when called by the processor are capable of performing the above-described methods.
In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium storing a computer program, which causes the computer to execute the above method.
According to the technical scheme, the characters of the watermark character string are sequentially and circularly embedded in the positions of the four neighborhoods of the centroid of the maximum connected domain, so that the watermark embedding positions of the single-frame images are different, and the robustness of the watermark information for resisting geometric attacks is improved; meanwhile, different watermark characters are embedded into each single-frame image, so that the method can resist multiple encoding operations, enhancement processing, frame extraction processing and the like, and is low in calculation complexity and high in calculation speed.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a video watermark embedding processing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of four neighborhoods of pixel points in a single frame image according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a video watermark embedding processing method according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a detection process of a video watermark according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a video watermark embedding processing apparatus according to an embodiment of the present invention;
fig. 6 is a logic block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following further describes embodiments of the present invention with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
Fig. 1 shows a flow chart of a video watermark embedding processing method provided by this embodiment, including:
s101, decoding the original video file to obtain single-frame images in YUV forms.
The video file is a video file to be embedded with the watermark.
Specifically, after a video file is decoded, a plurality of frames are obtained, and each frame is a single-frame image.
S102, for each single-frame image in the YUV form, separating Y, U, V components of the current single-frame image;
s103, acquiring a watermark embedding position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
and the watermark embedding position is the position of watermark information to be embedded in the current single-frame image.
S104, sequentially and circularly embedding each character sequence of the watermark character string into the watermark embedding position of each single-frame image Y component;
for example, the watermark character string is 10 characters, 100 frames of single-frame images exist after the video file is decoded, and 1-10 number characters are respectively embedded into the 1 st-10 frames of single-frame images, namely the 1 st frame of single-frame image is embedded into the 1 st character, the 2 nd frame of single-frame image is embedded into the 2 nd character … …, and the 10 th frame of single-frame image is embedded into the 10 th character; for the single-frame images of the 11 th to 20 th frames, the characters 1 to 10 are continuously embedded in a circulating mode, namely the single-frame image of the 11 th frame is embedded with the character 1, the single-frame image of the 12 th frame is embedded with the character 2 … …, and the single-frame image of the 20 th frame is embedded with the character 10; … … the 100 th frame single frame image is embedded with the 10 th character.
And S105, synthesizing the Y component of each single-frame image embedded with the watermark and the original U, V component into a target single-frame image in a YUV form.
And the target single-frame image is an image which is synthesized after the watermark is embedded.
And S106, encoding and outputting all target single-frame images into a target video file.
And the target video file is a video file embedded with the watermark.
In the embodiment, the characters of the watermark character string are sequentially and circularly embedded in the positions of the four neighborhoods of the centroid of the maximum connected domain, so that the watermark embedding positions of the single-frame images are different, and the robustness of the watermark information for resisting geometric attacks is improved; meanwhile, different watermark characters are embedded into each single-frame image, so that the method can resist multiple encoding operations, enhancement processing, frame extraction processing and the like, and is low in calculation complexity and high in calculation speed.
Further, on the basis of the above method embodiment, the watermark string is a binary string, and includes a start string and a watermark information string.
Correspondingly, S104 specifically includes:
sequentially embedding each character of the starting character string into the watermark embedding position of each single-frame image Y component;
sequentially embedding each character of the watermark information character string into the watermark embedding position of the Y component of each single-frame image from the next single-frame image;
and circularly embedding the characters of the starting character string and the watermark information character string into the watermark embedding positions of the Y components of the single-frame images until the watermark embedding positions of the Y components of all the single-frame images are embedded with the watermark characters.
Further, the watermark embedding position of each single-frame image Y component is embedded into only one bit in the watermark character string.
For example, before embedding the watermark information, a binary string of a start string is embedded: 01010011, the corresponding string is S, indicating that watermark information is to be embedded thereafter.
Firstly, adding a first bit of a binary string of a starting character string at a watermark embedding position of a Y component of a decoded first frame single-frame image, adding a second bit of the binary string of the starting character string at a watermark embedding position of a Y component of a decoded second frame single-frame image, and so on until adding an eighth bit of the binary string of the starting character string at a watermark embedding position of a Y component of a decoded eighth frame single-frame image; then, adding a first bit of a watermark information binary string into a watermark embedding position of a Y component of the decoded ninth frame single-frame image; adding a second bit of the watermark information binary string into the watermark embedding position of the Y component of the decoded tenth frame single frame image, and so on; after the last bit of the binary string of the watermark information is embedded, the embedding is circulated from the first bit of the binary string of the starting character string until all the single-frame images are processed.
Further, on the basis of the above method embodiment, the watermark embedding positions are four neighbors of a centroid of a maximum connected domain of a Y component of a current single frame image, and the calculation of the four neighbors of the centroid specifically includes:
for each single frame image, calculating the positions (x, Y) of four neighborhoods of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000111
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
The maximum connected domain is a connected domain with the largest area in the single-frame image.
The center of mass of the single-frame image is the center of gravity of the gray value of the image.
The connected domain is an image area which is adjacent to each other in the single-frame image and has similar or same pixel value.
Further, on the basis of the above method embodiment, S104 specifically includes:
calculating the pixel value img (i, j) of the watermark embedding position (i, j) of each single-frame image Y component as follows:
Figure BDA0002351001590000121
Figure BDA0002351001590000122
mean=(org(i,j-1)+org(i+1,j-1)+org(i+1,j))/3
wherein org (i, j) is a pixel value before the watermark information is embedded into the coordinates (i, j); and flag is a character to be embedded in the watermark character string, off is an offset of a pixel value, and mean is an average value of pixel values of three neighborhoods of org (i, j-1), org (i +1, j-1) and org (i +1, j).
Specifically, after the watermark embedding position of the current single-frame image is determined, a pixel value img (i, j) is obtained through calculation, and the pixel value of the watermark embedding position is updated to img (i, j).
Further, on the basis of the above method embodiment, the video watermark embedding processing method further includes:
decoding the target video file to be detected to obtain single-frame images in YUV forms;
for each single-frame image in the YUV form, Y, U, V components of the current single-frame image are separated;
acquiring a watermark extraction position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
sequentially extracting characters of the watermark extraction position of each single-frame image Y component, and waiting to enter a watermark detection formula, wherein if a first preset number of character strings continuously output by the watermark detection formula are the starting character strings, a subsequent second preset number of character strings continuously output by the watermark detection formula are watermark information character strings;
and if the at least one group of extracted watermark information character strings is judged to be matched with the embedded watermark information character strings, determining that the watermark detection is successful.
Specifically, the method for acquiring the watermark extraction position is the same as the watermark embedding position, that is, the position of the four neighborhoods of the centroid of the maximum connected domain of the Y component of the current single-frame image.
For example, the position of the binary string (01010011) of the start string needs to be found before detecting the watermark information.
Firstly, extracting a binary value of a watermark extraction position of a Y component of a decoded first frame single-frame image, waiting to enter a watermark detection formula, and if an output character is 0, retaining the character; if the output character is 1, discarding the character; then, extracting a binary value of a watermark extraction position of the Y component of the decoded second frame single-frame image, waiting to enter a watermark detection formula, and if the output character is 1, retaining the character; if the output character is 0, discarding the character and the previously extracted character; and so on, until finding the binary value of the watermark extraction position of the Y component of the continuous eight-frame single-frame image to be input into the watermark detection formula, if the output is the binary string of the starting character string: 01010011, it can be considered that the binary string of the start string is located at this time, and the watermark information can be extracted from the next single frame image.
Further, on the basis of the above method embodiment, the watermark detection formula is:
Figure BDA0002351001590000131
mean=(img(i,j-1)+img(i+1,j-1)+img(i+1,j))/3
flag=flag(x,y+1)||flag(x-1,y)||flag(x+1,y)||flag(x,y-1)
img (i, j) is a pixel value of the pixel point (i, j) after the watermark information is embedded; mean is the average value of the pixel values of three neighborhoods org (i, j-1), org (i +1, j-1) and org (i +1, j) of org (i, j), and flag (i, j) is the pixel value of each pixel point in the four neighborhoods; and flag is an output value of the watermark detection formula.
The position relationship of each pixel in the four neighborhoods is shown in fig. 2.
Specifically, the binary value of the watermark extraction position of the Y component of the next frame of single frame image at the position of the binary string of the starting character string is extracted, the output value is used as the first bit of the binary string of the watermark information when the binary string of the starting character string is put into a watermark detection formula, and the like until all the single frame images are processed.
Fig. 3 shows a schematic diagram of a video watermark embedding process, which specifically includes the following steps:
step1, video decoding
And decoding the video file into single-frame images in a YUV form, and separating Y components of the single-frame images.
Step2, embedding watermark information
The order of embedding watermark information in the four neighborhoods is as follows: first the upper neighborhood (x, y +1), then the left neighborhood (x-1, y), then the right neighborhood (x +1, y), and finally the lower neighborhood (x, y-1). The four neighbors of a pixel are shown in fig. 2.
Step3, video coding
And synthesizing the Y component of the single-frame image embedded with the watermark information and the original U, V component into a target single-frame image in a YUV form, and finally encoding and outputting all the target single-frame images into a target video file.
Fig. 4 shows a schematic diagram of a video watermark detection process, which specifically includes the following steps:
step1, video decoding
And decoding the target video file into single-frame images in a YUV form, and separating Y components of the single-frame images.
Step2, detecting watermark information
The position of the binary string (01010011) of the start string needs to be found before the watermark information is detected.
Detection is performed according to the following watermark detection formula:
Figure BDA0002351001590000151
mean=(img(i,j-1)+img(i+1,j-1)+img(i+1,j))/3
flag=flag(x,y+1)||flag(x-1,y)||flag(x+1,y)||flag(x,y-1)
where img (i, j) is the pixel value after embedding the watermark information at coordinates (i, j); flag (i, j) is binary information extracted at coordinates (i, j), and flag is binary information extracted from the four-neighbor domains (x, y +1), (x-1, y), (x +1, y), (x, y-1).
Step 3: outputting detection information
And if the at least one group of detected watermark information character strings is judged to be matched with the embedded watermark information character strings, determining that the watermark detection is successful.
On the basis of ensuring invisibility and imperceptibility, the video watermark embedding processing method provided by the embodiment can resist multiple encoding operations, enhance processing such as brightness, contrast, hue and saturation, and frame extraction processing, and has good robustness to geometric attacks (cutting and scaling); and by embedding the watermark at the unfixed position of the spatial domain, the algorithm complexity is low, the embedding and detecting speed is high, the applicable scene is wide, and the timeliness is good.
Fig. 5 shows a schematic structural diagram of a video watermark embedding processing apparatus provided in this embodiment, where the apparatus includes: a video decoding module 501, a component separation module 502, a location acquisition module 503, a watermark embedding module 504, a component synthesis module 505, and a video encoding module 506, wherein:
the video decoding module 501 is configured to decode an original video file to obtain a single-frame image in each YUV format;
the component separation module 502 is configured to separate Y, U, V components of the current single frame image for each single frame image in the YUV format;
the position obtaining module 503 is configured to obtain, for a Y component of each single frame image, a watermark embedding position of the Y component of the current single frame image;
the watermark embedding module 504 is configured to sequentially and cyclically embed each character of the watermark character string into a watermark embedding position of each single-frame image Y component;
the component synthesis module 505 is configured to synthesize the Y component of each single frame image with embedded watermark and the original U, V component into a target single frame image in YUV form;
the video encoding module 506 is configured to encode and output all target single-frame images as a target video file.
In the embodiment, the characters of the watermark character string are sequentially and circularly embedded in the positions of the four neighborhoods of the centroid of the maximum connected domain, so that the watermark embedding positions of the single-frame images are different, and the robustness of the watermark information for resisting geometric attacks is improved; meanwhile, different watermark characters are embedded into each single-frame image, so that the method can resist multiple encoding operations, enhancement processing, frame extraction processing and the like, and is low in calculation complexity and high in calculation speed.
Further, on the basis of the above method and apparatus embodiments, the position obtaining module 503 is specifically configured to:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000161
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
Further, on the basis of the above method and apparatus embodiments, the watermark string is a binary string, and includes a start string and a watermark information string;
accordingly, the watermark embedding module is specifically configured to:
sequentially embedding each character of the starting character string into the watermark embedding position of each single-frame image Y component;
sequentially embedding each character of the watermark information character string into the watermark embedding position of the Y component of each single-frame image from the next single-frame image;
circularly embedding the characters of the starting character string and the watermark information character string into the watermark embedding positions of the Y components of the single-frame images in sequence until the watermark embedding positions of the Y components of all the single-frame images are embedded with watermark characters;
and the watermark embedding position of each single-frame image Y component is embedded into only one bit in the watermark character string.
Further, on the basis of the above method and apparatus embodiments, the watermark embedding module 504 is specifically configured to:
calculating the pixel value img (i, j) of the watermark embedding position (i, j) of each single-frame image Y component as follows:
Figure BDA0002351001590000171
Figure BDA0002351001590000172
mean=(org(i,j-1)+org(i+1,j-1)+org(i+1,j))/3
wherein org (i, j) is a pixel value before the watermark information is embedded into the coordinates (i, j); and flag is a character to be embedded in the watermark character string, off is an offset of a pixel value, and mean is an average value of pixel values of three neighborhoods of org (i, j-1), org (i +1, j-1) and org (i +1, j).
Further, on the basis of the above embodiment of the method and apparatus, the apparatus for embedding a video watermark further includes:
the video secondary decoding module is used for decoding the target video file to be detected to obtain single-frame images in YUV forms;
the component secondary separation module is used for separating Y, U, V components of the current single-frame image aiming at each single-frame image in the YUV form;
the position secondary acquisition module is used for acquiring the watermark extraction position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
the watermark detection module is used for sequentially extracting the characters at the watermark extraction position of each single-frame image Y component in sequence and waiting to enter a watermark detection formula, and if the first preset number of character strings continuously output by the watermark detection formula are the starting character strings, the subsequent second preset number of character strings continuously output by the watermark detection formula are watermark information character strings;
and the detection success determining module is used for determining that the watermark detection is successful if at least one group of extracted watermark information character strings is matched with the embedded watermark information character strings.
Further, on the basis of the embodiment of the method and apparatus, the watermark extraction positions are four neighbors of a centroid of a maximum connected domain of a Y component of a current single frame image, and the calculation of the four neighbors of the centroid specifically includes:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure BDA0002351001590000181
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
Further, on the basis of the above embodiment of the method and apparatus, the watermark detection formula is:
Figure BDA0002351001590000191
mean=(img(i,j-1)+img(i+1,j-1)+img(i+1,j))/3
flag=flag(x,y+1)||flag(x-1,y)||flag(x+1,y)||flag(x,y-1)
the method comprises the following steps that img (i, j) is a pixel value of a pixel point (i, j) after watermark information is embedded, mean is an average value of pixel values of three neighborhoods org (i, j-1), org (i +1, j-1) and org (i +1, j) of org (i, j), and flag (i, j) is a pixel value of each pixel point in four neighborhoods; and flag is an output value of the watermark detection formula.
The video watermark embedding processing apparatus described in this embodiment may be used to implement the above method embodiments, and the principle and technical effect are similar, which are not described herein again.
Referring to fig. 6, the electronic device includes: a processor (processor)601, a memory (memory)602, and a bus 603;
wherein the content of the first and second substances,
the processor 601 and the memory 602 communicate with each other through the bus 603;
the processor 601 is used for calling the program instructions in the memory 602 to execute the methods provided by the above-mentioned method embodiments.
The present embodiments disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the above-described method embodiments.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the methods provided by the method embodiments described above.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
It should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A method for embedding a video watermark, comprising:
decoding an original video file to obtain single-frame images in YUV forms;
for each single-frame image in the YUV form, Y, U, V components of the current single-frame image are separated;
acquiring a watermark embedding position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
sequentially and circularly embedding each character of the watermark character string into the watermark embedding position of each single-frame image Y component;
synthesizing the Y component of each single-frame image embedded with the watermark and the original U, V component into a target single-frame image in a YUV form;
all target single-frame images are coded and output as target video files;
the watermark embedding positions are four adjacent domains of a centroid of a maximum connected domain of a current single-frame image Y component, and the calculation of the four adjacent domains of the centroid specifically comprises the following steps:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure FDA0003493319360000011
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
2. The method of claim 1, wherein the watermark string is a binary string including a start string and a watermark information string;
correspondingly, the sequentially and circularly embedding each character sequence of the watermark character string into the watermark embedding position of each single-frame image Y component specifically includes:
sequentially embedding each character of the starting character string into the watermark embedding position of each single-frame image Y component;
sequentially embedding each character of the watermark information character string into the watermark embedding position of the Y component of each single-frame image from the next single-frame image;
circularly embedding the characters of the starting character string and the watermark information character string into the watermark embedding positions of the Y components of the single-frame images in sequence until the watermark embedding positions of the Y components of all the single-frame images are embedded with watermark characters;
and the watermark embedding position of each single-frame image Y component is embedded into only one bit in the watermark character string.
3. The method for embedding processing of a video watermark according to claim 1, wherein the sequentially embedding each character of the watermark character string in a cyclic manner into the watermark embedding position of the Y component of each single frame image specifically comprises:
calculating the pixel value img (i, j) of the watermark embedding position (i, j) of each single-frame image Y component as follows:
Figure FDA0003493319360000021
Figure FDA0003493319360000022
mean=(org(i,j-1)+org(i+1,j-1)+org(i+1,j))/3
wherein org (i, j) is a pixel value before the watermark information is embedded into the coordinates (i, j); and flag is a character to be embedded in the watermark character string, off is an offset of a pixel value, and mean is an average value of pixel values of three neighborhoods of org (i, j-1), org (i +1, j-1) and org (i +1, j).
4. The method for embedding processing of video watermark according to claim 2, wherein the method for embedding processing of video watermark further comprises:
decoding the target video file to be detected to obtain single-frame images in YUV forms;
for each single-frame image in the YUV form, Y, U, V components of the current single-frame image are separated;
acquiring a watermark extraction position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
sequentially extracting characters of the watermark extraction position of each single-frame image Y component, substituting the characters into a watermark detection formula, and if a first preset number of character strings continuously output by the watermark detection formula are the starting character strings, a subsequent second preset number of character strings continuously output by the watermark detection formula are watermark information character strings;
and if the at least one group of extracted watermark information character strings is judged to be matched with the embedded watermark information character strings, determining that the watermark detection is successful.
5. The method according to claim 4, wherein the watermark extraction positions are four neighbors of a centroid of a maximum connected domain of a Y component of a current single frame image, and the calculation of the four neighbors of the centroid specifically comprises:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure FDA0003493319360000031
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
6. The method of claim 5, wherein the watermark detection formula is:
Figure FDA0003493319360000041
mean=(img(i,j-1)+img(i+1,j-1)+img(i+1,j))/3
flag=flag(x,y+1)||flag(x-1,y)||flag(x+1,y)||flag(x,y-1)
the method comprises the following steps that img (i, j) is a pixel value of a pixel point (i, j) after watermark information is embedded, mean is an average value of pixel values of three neighborhoods org (i, j-1), org (i +1, j-1) and org (i +1, j) of org (i, j), and flag (i, j) is a pixel value of each pixel point in four neighborhoods; and flag is an output value of the watermark detection formula.
7. An apparatus for embedding a video watermark, comprising:
the video decoding module is used for decoding the original video file to obtain single-frame images in YUV forms;
the component separation module is used for separating Y, U, V components of the current single-frame image aiming at each single-frame image in the YUV form;
the position acquisition module is used for acquiring the watermark embedding position of the Y component of the current single-frame image aiming at the Y component of each single-frame image;
the watermark embedding module is used for sequentially and circularly embedding all the characters of the watermark character string into the watermark embedding positions of the Y components of all the single-frame images;
the component synthesis module is used for synthesizing the Y component of each single-frame image embedded with the watermark and the original U, V component into a target single-frame image in a YUV form;
the video coding module is used for coding and outputting all target single-frame images into a target video file;
the watermark embedding positions are four adjacent domains of a centroid of a maximum connected domain of a current single-frame image Y component, and the calculation of the four adjacent domains of the centroid specifically comprises the following steps:
for each single frame image, calculating the position (x, Y) of the centroid of the largest connected domain of the single frame image Y component:
Figure FDA0003493319360000051
wherein i is the horizontal direction of the Y component of the single-frame image, m is the number of pixels in the horizontal direction of the Y component of the single-frame image, j is the vertical direction of the Y component of the single-frame image, n is the number of pixels in the vertical direction of the Y component of the single-frame image, and p (i, j) is the gray value of a pixel point (i, j) in the Y component of the single-frame image;
according to the position (x, y) of the centroid of the maximum connected domain, determining the position of an upper neighborhood as (x, y +1), the position of a left neighborhood as (x-1, y), the position of a right neighborhood as (x +1, y), and the position of a lower neighborhood as (x, y-1); the four neighbors of the centroid include the upper neighbor, the left neighbor, the right neighbor, and the lower neighbor.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the video watermark embedding processing method according to any one of claims 1 to 6 when executing the program.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the video watermark embedding processing method according to any one of claims 1 to 6.
CN201911415147.6A 2019-12-31 2019-12-31 Video watermark embedding processing method and device, electronic equipment and storage medium Active CN111107370B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911415147.6A CN111107370B (en) 2019-12-31 2019-12-31 Video watermark embedding processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911415147.6A CN111107370B (en) 2019-12-31 2019-12-31 Video watermark embedding processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111107370A CN111107370A (en) 2020-05-05
CN111107370B true CN111107370B (en) 2022-04-19

Family

ID=70425667

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911415147.6A Active CN111107370B (en) 2019-12-31 2019-12-31 Video watermark embedding processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111107370B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111669615B (en) * 2020-05-13 2022-09-30 北京奇艺世纪科技有限公司 Video stream processing method and device
CN111641879B (en) * 2020-06-08 2022-04-12 北京永新视博数字电视技术有限公司 Video watermark adding method, device, storage medium and equipment
CN112040337B (en) * 2020-09-01 2022-04-15 腾讯科技(深圳)有限公司 Video watermark adding and extracting method, device, equipment and storage medium
CN113596497A (en) * 2021-07-28 2021-11-02 新华智云科技有限公司 Multi-channel live video synchronization method and system based on hidden watermark
CN115358911B (en) * 2022-10-20 2023-01-31 北京万里红科技有限公司 Screen watermark generation method, device, equipment and computer readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419702B (en) * 2008-05-30 2012-03-28 董申 Semi-fragile watermarking method for color image tamper localization and recovery
CN105611291B (en) * 2015-12-31 2019-01-08 上海众源网络有限公司 The method and apparatus that mark information is added in the video frame and detects frame losing
CN108062746A (en) * 2016-11-09 2018-05-22 深圳市优朋普乐传媒发展有限公司 A kind of method of video image processing and device, video coding system

Also Published As

Publication number Publication date
CN111107370A (en) 2020-05-05

Similar Documents

Publication Publication Date Title
CN111107370B (en) Video watermark embedding processing method and device, electronic equipment and storage medium
US11838509B2 (en) Video coding method and apparatus
Zhang et al. Robust invisible video watermarking with attention
CN105741224B (en) The reversible water mark algorithm divided based on PVO and adaptive block
JP5654434B2 (en) Method and apparatus for embedding watermark image in host image
EP2314073B1 (en) Selection of watermarks for the watermarking of compressed video
US10893270B2 (en) Image encoding device, image encoding method, and image encoding program, and image decoding device, image decoding method, and image decoding program
CN111445424B (en) Image processing method, device, equipment and medium for processing mobile terminal video
EP2960855A1 (en) Method and device for determining a set of modifiable elements in a group of pictures
CN113538197B (en) Watermark extraction method, watermark extraction device, storage medium and electronic equipment
CN108805788B (en) Reversible watermarking method based on image topological structure
CN115375527A (en) Image processing method, device, equipment and storage medium
JP6498858B2 (en) Image coding method
Liao et al. Improving the adaptive steganographic methods based on modulus function
JP2007143123A (en) Image processing apparatus, image processing method, image processing program, and recording medium
CN113763224A (en) Image processing method and device
CN113395475B (en) Data processing method and device, electronic equipment and storage equipment
CN113674130A (en) Image processing method and device, storage medium and terminal
CN114549270A (en) Anti-shooting monitoring video watermarking method combining depth robust watermarking and template synchronization
CN112887730A (en) Video coding and decoding method and device
CN110570343A (en) Image watermark embedding method and device based on self-adaptive feature point extraction
CN117156154A (en) Dual video watermark embedding method, dual video watermark extracting device and electronic equipment
Goncharenko et al. Blind watermarking algorithm for a sequence of TV images
Kang et al. Compressing JPEG compressed image using reversible data hiding technique
Sii et al. Rewritable Data Embedding in Image based on Improved Coefficient Recovery

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