Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, embodiments of the present invention will be further described with reference to the accompanying drawings, wherein specific technical details are set forth below, such as: methods, apparatus, etc. may be used solely for the purpose of facilitating a better understanding of the subject matter and are not intended to limit the invention to the details shown.
The embodiment of the invention provides a robust video watermark embedding and extracting method, equipment and storage equipment thereof. Referring to fig. 1, fig. 1 is an overall flowchart of a robust video watermark embedding and extracting method according to an embodiment of the present invention, where the method is implemented by a robust video watermark embedding and extracting apparatus, and includes the following specific steps:
s101: and adjusting and reading the binary watermark (which can be a BMP format image).
S102: storing the pixel values; storing pixel values with an array W [ k ]; the number of pixels M is XY, X is the length of the watermark, and Y is the width of the watermark.
S103: expanding the pixel value and inserting a start and end flag bit; the rule for extending W [ k ] is that W [0] ═ 0, W [1] ═ 1, W [2] ═ 0, W [3] ═ 1, …, W [ k +4] ═ W [ k ], …, W [ M +4] ═ 0, W [ M +5] ═ 1, W [ M +6] ═ 0, and W [ M +7] ═ 0, and the extension has a flag bit inserted.
S104: acquiring a frame of a video and setting a threshold value of a pixel channel mean value; for better invisibility, the frames with rich color information are selected. The pixel channels comprise a red pixel channel, a green pixel channel and a blue pixel channel;
P
Ris the pixel mean, P, in the red pixel channel
GIs the pixel mean, P, in the green pixel channel
BIs the pixel mean in the blue pixel channel; the threshold value of the pixel channel mean value is (50, 200); wherein,
m, N are the length and width of one frame image, and P (x, y) is the pixel value of the coordinates (x, y).
S105: and screening frames with the pixel channel mean value meeting the threshold value as embedded objects.
S106: obtaining an abscissa value T of a left edge pixel of the frame which meets a threshold; detecting the longitudinal edge of the video by using a sobel operator to obtain the minimum value of the pixel abscissa, namely T; the edge detection uses a matrix
The video frames are convolved.
S107: embedding the watermark into the obtained video frame to obtain a video containing the watermark; embedding of watermarks is performed according to the following equation
Where P (T, k) represents the T-th column, the k-th row of RGB pixel values, 0 for black, and 1 for white of the video frame.
S108: and analyzing the video containing the watermark to obtain a video frame.
S109: and obtaining an abscissa value T of the pixel at the leftmost edge of the video frame.
S110: the watermark marker sequence in column T is detected.
S111: extracting a watermark according to the pixel channel mean value; reduction of W [ k ] according to the following formula
Wherein, PB(T, k) is the mean of the blue (passivation high) channel of the pixel at coordinate (T, k). Then, removing the mark bit to obtain W [ k ] of the original watermark]And further extracting the watermark.
Referring to fig. 2, fig. 2 is an enlarged view of the watermarked frame of the present invention, wherein: 201 represents 0 (black) and 202 represents 1 (white).
Referring to fig. 3, fig. 3 is a schematic diagram of detecting left side edges of video frames before embedding watermark in the embodiment of the present invention, wherein: 301 denotes the leftmost edge detected and 302 denotes the edges of other positions detected.
Referring to fig. 4, fig. 4 is a schematic diagram of detecting left edges of a video frame after embedding a watermark in the embodiment of the present invention, where: 401 indicates the leftmost edge detected, and the white line portion in the figure is the other edge detected.
Referring to fig. 5, fig. 5 is a video comparison diagram before and after watermark embedding in the embodiment of the present invention, where: 501 denotes a video before embedding a watermark, and 502 denotes a video after embedding a watermark. As can be seen, the embedded watermark has no effect on the video picture.
Referring to fig. 6, fig. 6 is a schematic diagram of a hardware device according to an embodiment of the present invention, where the hardware device specifically includes: a robust video watermark embedding and extraction device 601, a processor 602 and a storage device 603.
Robust video watermark embedding and extraction device 601: the robust video watermark embedding and extracting device 601 implements the robust video watermark embedding and extracting method.
The processor 602: the processor 602 loads and executes the instructions and data in the storage device 603 for implementing a robust video watermark embedding and extraction method.
The storage device 603: the storage device 603 stores instructions and data; the storage device 603 is used to implement the robust video watermark embedding and extracting method.
All the technical features of the claims of the present invention are elaborated upon by implementing the embodiments of the present invention.
Different from the prior art, the embodiment of the invention provides a robust video watermark embedding and extracting method, device and storage device thereof, which support video streaming media real-time embedding and extraction (inverse embedding) by embedding a watermark into the leftmost edge of a video according to a specific rule after binary coding. Meanwhile, the embedding rule uses the peer-to-peer rule of the video pixel and the watermark pixel, so that the protection capability of the watermark to compression, reproduction (including but not limited to) and other attacks can be effectively improved. I.e. the robustness of the watermark is improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.