CN111445376B - Video watermark detection method, device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN111445376B
CN111445376B CN202010212767.6A CN202010212767A CN111445376B CN 111445376 B CN111445376 B CN 111445376B CN 202010212767 A CN202010212767 A CN 202010212767A CN 111445376 B CN111445376 B CN 111445376B
Authority
CN
China
Prior art keywords
binarized
video frame
watermark
image
quadrant
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
CN202010212767.6A
Other languages
Chinese (zh)
Other versions
CN111445376A (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.)
Wuba Co Ltd
Original Assignee
Wuba 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 Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN202010212767.6A priority Critical patent/CN111445376B/en
Publication of CN111445376A publication Critical patent/CN111445376A/en
Application granted granted Critical
Publication of CN111445376B publication Critical patent/CN111445376B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0065Extraction of an embedded watermark; Reliable detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence

Abstract

The application discloses a method, a device, electronic equipment and a storage medium for detecting video watermarks, wherein the method firstly acquires a preset number of binarized video frame images from a video file; then, carrying out convolution operation on the binarized video frame image by using the binarized watermark image to obtain a target sub-block corresponding to the maximum convolution result in the binarized video frame image; comparing the binary pixel values of the corresponding positions of the watermark image and the target sub-block to judge whether the binary video frame image contains the watermark or not; and finally, determining whether the video file contains the watermark according to the judging result corresponding to part or all of the binarized video frame images. The method can realize the detection of the video watermark under the condition of the watermark speed movement position, and has extremely low error rate and omission rate.

Description

Video watermark detection method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of watermark detection technologies, and in particular, to a method and apparatus for detecting a video watermark, an electronic device, and a storage medium.
Background
The watermark is embedded in the video, so that the video can be prevented from being tampered, the video source is marked, and other people are prevented from stealing the video, and the effects of protecting the copyright of the video and protecting the interests of copyrighters are achieved. For example, in the field of real estate renting information service, a copyright party accesses a watermark detection service and a watermark embedding service to a real estate information platform, when the real estate information platform receives a real estate video uploaded by a user (such as a real estate broker), the copyright party detects whether the real estate video contains a watermark through the watermark detection service, if the watermark is detected, the video is determined to be a pirated video so as to prevent release, and if the watermark is not detected, the video is determined to be a non-pirated video, and at the moment, the watermark is embedded in the real estate video through the watermark embedding service and then released.
According to the motion state of the watermark in the video, the video watermark can be divided into a static watermark and a dynamic watermark, the position of the static watermark in the video is fixed, and the dynamic watermark moves along with the playing of the video. A method for detecting dynamic watermark includes extracting multiple frames from video according to a certain rule on the premise of known watermark motion speed, carrying out gradient calculation on each frame of frame by utilizing Sobel operator to obtain gradient image, carrying out translation superposition on obtained gradient image according to watermark motion speed to strengthen watermark-containing part in frame, and finally predicting whether enhanced image contains watermark or not by using pre-trained classification model.
It can be seen that the watermark detection method depends on the watermark motion speed, and if the watermark speed is unknown, the watermark cannot be detected.
Disclosure of Invention
The application provides a method, a device, electronic equipment and a storage medium for detecting video watermarks, which are used for solving the watermark detection problem under the condition that the watermark moving speed is unknown.
In a first aspect, the present application provides a method for detecting a video watermark, the method comprising:
acquiring a preset number of binarized video frame images from a video file;
acquiring a binarized watermark image, carrying out convolution operation on the binarized video frame image by taking the binarized watermark image as a convolution check to obtain a convolution result matrix, and determining a target sub-block in the binarized video frame image, wherein the convolution result matrix comprises at least one convolution result, each convolution result corresponds to one sub-block in the binarized video frame image, and the target sub-block is a sub-block corresponding to the maximum convolution result in the convolution result matrix;
judging whether the binarized video frame image contains a watermark or not by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block;
and determining whether the video file contains the watermark according to the judging result corresponding to part or all of the binarized video frame images.
Further, the acquiring the binarized watermark image includes:
obtaining a watermark image, and performing edge detection processing on the watermark image to obtain an edge watermark image;
performing binarization processing on the marginalized watermark image to obtain the binarized watermark image;
the method comprises the steps of obtaining a preset number of binarized video frame images from a video file:
acquiring a video frame sequence from a video file, wherein the video frame sequence comprises a preset number of video frame images;
performing edge detection on the preset number of video frame images to obtain the preset number of video frame edge images;
and carrying out binarization processing on the preset number of video frame edge images to obtain the preset number of binarized video frame images.
Further, the determining whether the binarized video frame image contains a watermark by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block includes:
counting the number of pixels falling into each preset quadrant according to the binarized pixel values of the pixels at the corresponding positions of the preset watermark image and the target sub-block, wherein the preset quadrant comprises a quadrant A, a quadrant B, a quadrant C and a quadrant D, the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant A are respectively 1 and 1, the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant B are respectively 0 and 1, the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant C are respectively 1 and 0, and the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant D are respectively 0 and 0;
judging whether the number of pixel points falling into each quadrant accords with the preset number range of the quadrants;
if the number of pixel points falling into each quadrant accords with the preset number range of the quadrants, determining that the binarized video frame image contains watermarks;
and if the number of the pixel points falling into at least one quadrant does not accord with the preset number range of the quadrant, determining that the binarized video frame image does not contain the watermark.
Further, the determining whether the video file contains the watermark according to the judging result corresponding to part or all of the binarized video frame images includes:
if the binarized video frame images corresponding to the video frame images of the previous m frames in the video frame sequence do not contain watermarks, determining that the video file does not contain watermarks;
if at least two binarized video frame images corresponding to n frames of video frame images in the video frame sequence contain watermarks, determining that the video file contains watermarks;
wherein m and n are preset detection thresholds, and n is more than or equal to 1 and less than m and less than the preset quantity.
Further, the convoluting operation is performed on the binarized video frame image by taking the binarized watermark image as a convolution check, including:
converting the binarized watermark image and the binarized video frame image into a watermark matrix and a video frame matrix respectively;
and taking the watermark matrix as a convolution kernel, and carrying out convolution operation on the video frame matrix according to a preset moving direction and step length to obtain a convolution result matrix.
In a second aspect, the present application also provides a device for detecting a video watermark, the device comprising:
the acquisition module is used for acquiring a preset number of binarized video frame images from the video file and acquiring binarized watermark images;
the convolution module is used for carrying out convolution operation on the binarized video frame image by taking the binarized watermark image as a convolution check to obtain a convolution result matrix, determining a target sub-block in the binarized video frame image, wherein the convolution result matrix comprises at least one convolution result, each convolution result corresponds to one sub-block in the binarized video frame image, and the target sub-block is a sub-block corresponding to the maximum convolution result in the convolution result matrix;
the judging module is used for judging whether the binarized video frame image contains a watermark or not by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block;
and the determining module is used for determining whether the video file contains the watermark according to the judging result corresponding to part or all of the binarized video frame images.
Further, the acquisition module includes:
the first acquisition unit is used for acquiring a watermark image, and carrying out edge detection processing on the watermark image to obtain an edge watermark image; performing binarization processing on the marginalized watermark image to obtain the binarized watermark image; the method comprises the steps of obtaining a preset number of binarized video frame images from a video file:
the second acquisition unit is used for acquiring a video frame sequence from the video file, wherein the video frame sequence comprises a preset number of video frame images; performing edge detection on the preset number of video frame images to obtain the preset number of video frame edge images; and carrying out binarization processing on the preset number of video frame edge images to obtain the preset number of binarized video frame images.
Further, the judging module includes:
a statistics unit, configured to count, according to binarized pixel values of pixel points at corresponding positions of the preset watermark image and the target sub-block, the number of pixel points falling into each preset quadrant, where the preset quadrant includes a quadrant a, a quadrant B, a quadrant C, and a quadrant D, the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant a are respectively 1 and 1, the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant B are respectively 0 and 1, the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant C are respectively 1 and 0, and the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant D are respectively 0 and 0;
the judging unit is used for judging whether the number of the pixel points falling into each quadrant accords with the number range preset by the quadrant; if the number of pixel points falling into each quadrant accords with the preset number range of the quadrants, determining that the binarized video frame image contains watermarks; and if the number of the pixel points falling into at least one quadrant does not accord with the preset number range of the quadrant, determining that the binarized video frame image does not contain the watermark.
Further, the determining module is specifically configured to:
if the binarized video frame images corresponding to the video frame images of the previous m frames in the video frame sequence do not contain watermarks, determining that the video file does not contain watermarks;
if at least two binarized video frame images corresponding to n frames of video frame images in the video frame sequence contain watermarks, determining that the video file contains watermarks;
wherein m and n are preset detection thresholds, and n is more than or equal to 1 and less than m and less than the preset quantity.
Further, the convolution module includes:
the matrix conversion unit is used for respectively converting the binarized watermark image and the binarized video frame image into a watermark matrix and a video frame matrix;
and the convolution operation unit is used for carrying out convolution operation on the video frame matrix according to a preset moving direction and step length by taking the watermark matrix as a convolution kernel to obtain a convolution result matrix.
In a third aspect, the present application also provides an electronic device, including:
a memory for storing program instructions;
and a processor for calling and executing program instructions in the memory to implement the method according to the first aspect.
In a fourth aspect, the present application also provides a storage medium having stored therein a computer program which, when executed by at least one processor of an apparatus according to the second aspect, performs the method according to the first aspect.
As can be seen from the above technical solutions, the embodiments of the present application provide a method, an apparatus, an electronic device, and a storage medium for detecting a video watermark, where the method first obtains a preset number of binarized video frame images from a video file; then, carrying out convolution operation on the binarized video frame image by using the binarized watermark image to obtain a target sub-block corresponding to the maximum convolution result in the binarized video frame image; then, judging whether the binarized video frame image contains the watermark or not by comparing the binarized watermark image with the binarized pixel value at the corresponding position of the target sub-block; and finally, determining whether the video file contains the watermark according to the judging result corresponding to part or all of the binarized video frame images. The method can realize the detection of the video watermark under the condition of the watermark speed movement position, and has extremely low error rate and omission rate.
Drawings
In order to more clearly illustrate the technical solution of the present application, the drawings that are needed in the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flowchart of a method for detecting a video watermark according to an exemplary embodiment of the application;
fig. 2 is a block diagram of a video watermark detection apparatus according to an exemplary embodiment of the present application;
fig. 3 is a schematic hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solution of the present application better understood by those skilled in the art, the technical solution of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
In the field of digital watermarking, watermark embedding algorithm is used for embedding watermark images into video files, so that video can be prevented from being tampered, video sources can be marked, other people can be prevented from stealing the video, and the effects of protecting video copyrights and copyrights can be achieved. However, if the watermark embedding algorithm is hacked by the video pirate, this means that the watermark in the video will be perfectly removed by the pirate.
The dynamic watermark embedding algorithm is a research product of the static watermark embedding algorithm after being cracked by a pirate. The motion speed of the dynamic watermark is the key to crack the watermark embedding algorithm. Since the watermark motion speeds of all video files obtained by using the same embedding algorithm are the same, if a pirate obtains the watermark motion speed of one video and breaks the watermark embedding algorithm used by the video, the watermark embedding algorithm used by breaking all videos is equivalent, so that batch processing of the video is realized.
In order to further improve the attack resistance of the watermark embedding algorithm, when watermark embedding processing is carried out on each watermark-free video, the watermark embedding algorithm randomly generates watermark motion speed values for completing watermark embedding of the video, so that the obtained watermark motion speeds of each watermark video are different, and further, a pirate is prevented from cracking.
However, although randomization of watermark motion speed in different watermark videos can prevent a pirate from cracking the embedding algorithm, the watermark detection technology is also hindered. The method is characterized in that on the premise that the motion speed of the watermark is known, a plurality of picture frames are extracted from a video according to a certain rule, then gradient calculation is carried out on each frame of picture by utilizing a Sobel operator to obtain a gradient image, the obtained gradient image is subjected to translation superposition according to the motion speed of the watermark so as to strengthen the part containing the watermark in the picture, and finally a pre-trained classification model is used for predicting whether the enhanced image contains the watermark. That is, the existing watermark detection method depends on the watermark motion speed, and if the watermark motion speed is unknown, the detection cannot be performed.
In order to implement detection of a video watermark in the case that the watermark motion speed is unknown, an embodiment of the present application provides a method for detecting a video watermark, fig. 1 is a flowchart of an exemplary embodiment of the method, and as shown in fig. 1, the method may include:
step 100, obtaining a preset number of binarized video frame images from a video file.
In step 100, firstly, frames of a video file to be detected are extracted, the number of the extracted frames is a preset number N, and the extracted N frames of video frame images form a video frame sequence. In some embodiments, m < N < 50, where m is a preset first detection threshold; then, carrying out edge detection on each video frame image to obtain a preset number of video frame edge images; and performing binarization processing on the edge image of each video frame to obtain a preset number of binarized video frame images.
Step 200, a binary watermark image is obtained, the binary watermark image is taken as a convolution check, convolution operation is carried out on the binary video frame image, a convolution result matrix is obtained, a target sub-block in the binary video frame image is determined, the convolution result matrix comprises at least one convolution result, each convolution result corresponds to one sub-block in the binary video frame image, and the target sub-block is the sub-block corresponding to the maximum convolution result in the convolution result matrix.
The watermark image is the detection target of the method, and the purpose of the method is to detect whether the watermark image is in the video file.
As a possible implementation manner, acquiring the binarized watermark image specifically includes: firstly, obtaining a watermark image, and carrying out edge detection processing on the watermark image to obtain an edge watermark image; and then carrying out binarization processing on the marginalized watermark image to obtain the binarized watermark image.
It should be noted that there are many methods for implementing the edge detection process, such as search-based and zero-crossing-based edge detection algorithms. Wherein the search-based edge detection method first calculates the edge intensity, typically represented by a first derivative, e.g. a gradient modulus, then estimates the local direction of the edge, typically the direction of the gradient, and uses this direction to find the maximum of the local gradient modulus. The zero crossing based approach finds the zero crossing of the second derivative derived from the image to locate the edge, typically with either a laplace operator or a nonlinear differential equation. Since the method for implementing the edge detection process is well known to those skilled in the art, the description of the present application is omitted.
In these embodiments, by performing edge detection processing on the watermark image and the video frame image, irrelevant information can be removed on the basis of preserving important structural properties of the image, thereby greatly reducing the amount of data calculation.
Taking an edge video frame image as an example, an implementation of the above-mentioned binarization operation is described. Firstly, graying an edge video frame image by adopting an average value method to obtain a gray video frame image, and then, carrying out binarization processing on the gray video frame image by adopting a threshold value method, namely: dividing the pixel value distribution of the gray video frame image into two parts by taking a preset threshold value T as a boundary, if the pixel value of a certain pixel point is greater than or equal to T, making the binarized pixel value of the certain pixel point be 1, and if the pixel value of the certain pixel point is less than T, making the binarized pixel value of the certain pixel point be 0, thereby obtaining two binary video frame images with the pixel value of 0 or 1, wherein the preset threshold value T can be 128.
In step 200, for each binarized frame video frame image, features of the binarized video frame image are extracted by image convolution, intended to determine a portion of the binarized video frame image most similar to the binarized watermark image based on the feature extraction result (convolution result).
When the method is specifically implemented, firstly, a binarized watermark image and a binarized video frame image are respectively converted into a watermark matrix and a video frame matrix; then, taking the watermark matrix as a convolution kernel, and carrying out convolution operation on the video frame matrix according to a preset moving direction and step length to obtain a convolution result matrix, wherein the convolution result matrix comprises a plurality of convolution results, and each convolution result corresponds to one sub-block in the video frame image; and finally selecting the sub-block corresponding to the maximum convolution result as a target sub-block.
Illustratively, let the watermark image size axb, the matrix of watermark obtained by matrix transformation be [ axb ] (matrix of a row b column), the video frame image size axy, the matrix of video frame obtained by matrix transformation be [ axy ] (matrix of x row y column). And (3) carrying out convolution operation on the [ x y ] by taking the [ a x b ] as a convolution kernel and taking 1 as a moving step length, so as to obtain a convolution result matrix [ (y-b+1) × (x-a+1) ]. The convolution result matrix contains (y-b+1) × (x-a+1) elements, each element being a convolution result, each convolution result corresponding to a sub-block in the video frame image. The size of the convolution result represents the similarity degree of the watermark image and the sub-block corresponding to the convolution result, and the sub-block corresponding to the maximum convolution result in the (y-b+1) x (x-a+1) convolution results is most similar to the watermark image, so that the sub-block corresponding to the maximum convolution result is selected as the target sub-block.
And 300, judging whether the binarized video frame image contains the watermark or not by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block.
In this embodiment, the pixels of the binarized watermark image and the target sub-block at the corresponding positions form a pixel pair, and for convenience of distinguishing and description, the pixels of the pixel pair belonging to the watermark image are referred to as a first pixel, and the pixels of the pixel pair belonging to the target sub-block are referred to as a second pixel.
Specifically, whether the video frame image contains a watermark or not can be judged according to the following mode:
dividing four preset quadrants according to four possible combination modes of a first pixel point and a second pixel point in advance, wherein the four preset quadrants are respectively a quadrant A, a quadrant B, a quadrant C and a quadrant D, the binarization pixel values of the pixel points of the binarization watermark image and the target sub-block in the quadrant A at corresponding positions are respectively 1 and 1, namely the binarization pixel values of the first pixel point and the second pixel point are respectively 1 and 1, the binarization pixel values of the pixel points of the binarization watermark image and the target sub-block in the quadrant B at corresponding positions are respectively 0 and 1, namely the binarization pixel values of the first pixel point and the second pixel point are respectively 0 and 1, the binarization pixel values of the pixel points of the binarization watermark image and the target sub-block in the quadrant C at corresponding positions are respectively 1 and 0, namely the binarization pixel values of the first pixel point and the second pixel point are respectively 1 and 0, and the binarization pixel values of the pixel points of the binarization watermark image and the target sub-block in the quadrant C at corresponding positions are respectively 0 and 0.
And then counting the number of the pixels falling into each preset quadrant according to the binarized pixel values of the pixels at the corresponding positions of the preset watermark image and the target sub-block.
And respectively judging whether the number of pixel pairs falling into each quadrant accords with the preset number range of the quadrant, if the number of pixel pairs falling into each quadrant accords with the preset number range of the quadrant, determining that the binarized video frame image contains the watermark, and if the number of pixel pairs falling into at least one quadrant does not accord with the preset number range of the quadrant, determining that the binarized video frame image does not contain the watermark.
Step 400, determining whether the video file contains a watermark according to the judging result corresponding to part or all of the binarized video frame images.
Specifically, if the binarized video frame images corresponding to the video frame images of the previous m frames in the video frame sequence do not contain watermarks, determining that the video file does not contain watermarks; if at least n frames of video frame images in the video frame sequence correspond to binarized video frame images and contain watermarks, determining that the video file contains watermarks; wherein, m and N are preset detection thresholds, m is a first detection threshold, N is a second detection threshold, N is more than or equal to 1 and less than m and less than N (preset quantity).
In particular, when the method is implemented, the judgment result corresponding to each video frame image in the video frame sequence is stored in an array S, and the arrangement sequence of the judgment results in the array S is matched with the arrangement sequence of the video frame images in the video frame sequence. On the basis, sequentially reading the judgment results stored in the array S, if the m-th judgment result (namely, the judgment result corresponding to the m-th video frame image) is read, the result containing the watermark is not read yet, which means that the previous m-th video frame image in the video frame sequence does not contain the watermark, at the moment, the reading is stopped, the video file is considered to contain no watermark, if n watermark-containing results are read before the m-th judgment result is read, the reading is stopped when the n-th watermark-containing result is read, and the video file is considered to contain the watermark; if the m-th judging result is read, the watermark-containing result is already read but the number is less than n, continuing to read the m+1th judging result until at least n watermark-containing results are read, stopping reading, and considering that the video file contains the watermark.
The video watermark detection method provided by the embodiment of the application is tested by using 1859 watermark-containing videos and 1860 watermark-free videos as test samples, and the test results are shown in table 1:
TABLE 1
Test sample Total number of Detecting the amount of watermarks Detecting the number of non-aqueous prints Error rate Leak rate
Video with watermark 1859 1776 83 0 4.47%
Watermarking-free video 1000 4 1856 0.20 0
The detection omission condition is detected, and the main reason for the detection omission is that the video is too fuzzy.
As can be seen from the test results shown in Table 1, the video watermark detection method provided by the application has extremely low error rate and omission rate.
As can be seen from the above embodiments, the embodiments of the present application provide a method for detecting a video watermark, which includes first obtaining a preset number of binarized video frame images from a video file; then, carrying out convolution operation on the binarized video frame image by using the binarized watermark image to obtain a target sub-block corresponding to the maximum convolution result in the binarized video frame image; then, judging whether the binarized video frame image contains the watermark or not by comparing the binarized watermark image with the binarized pixel value at the corresponding position of the target sub-block; and finally, determining whether the video file contains the watermark according to the judging result corresponding to part or all of the binarized video frame images. The method can realize the detection of the video watermark under the condition of the watermark speed movement position, and has extremely low error rate and omission rate.
According to the method for detecting a video watermark provided in the foregoing embodiment, an embodiment of the present application further provides a device for detecting a video watermark, as shown in fig. 2, where the device may include:
an obtaining module 210, configured to obtain a preset number of binarized video frame images from a video file, and obtain a binarized watermark image; the convolution module 220 is configured to perform convolution operation on the binarized video frame image by using the binarized watermark image as a convolution check, to obtain a convolution result matrix, determine a target sub-block in the binarized video frame image, where the convolution result matrix includes at least one convolution result, each convolution result corresponds to one sub-block in the binarized video frame image, and the target sub-block is a sub-block corresponding to a maximum convolution result in the convolution result matrix; a judging module 230, configured to judge whether the binarized video frame image contains a watermark by comparing the binarized watermark image with a binarized pixel value of a pixel point at a position corresponding to the target sub-block; the determining module 240 is configured to determine whether the video file contains a watermark according to a result of the determination corresponding to a part or all of the binarized video frame images.
In some embodiments, the acquisition module comprises: the first acquisition unit is used for acquiring a watermark image, and carrying out edge detection processing on the watermark image to obtain an edge watermark image; performing binarization processing on the marginalized watermark image to obtain the binarized watermark image; the method comprises the steps of obtaining a preset number of binarized video frame images from a video file: the second acquisition unit is used for acquiring a video frame sequence from the video file, wherein the video frame sequence comprises a preset number of video frame images; performing edge detection on the preset number of video frame images to obtain the preset number of video frame edge images; and carrying out binarization processing on the preset number of video frame edge images to obtain the preset number of binarized video frame images.
In some embodiments, the determining module includes: a statistics unit, configured to count, according to binarized pixel values of pixel points at corresponding positions of the preset watermark image and the target sub-block, the number of pixel points falling into each preset quadrant, where the preset quadrant includes a quadrant a, a quadrant B, a quadrant C, and a quadrant D, the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant a are respectively 1 and 1, the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant B are respectively 0 and 1, the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant C are respectively 1 and 0, and the binarized pixel values of pixel points at corresponding positions of the binary watermark image and the target sub-block in the quadrant D are respectively 0 and 0; the judging unit is used for judging whether the number of the pixel points falling into each quadrant accords with the number range preset by the quadrant; if the number of pixel points falling into each quadrant accords with the preset number range of the quadrants, determining that the binarized video frame image contains watermarks; and if the number of the pixel points falling into at least one quadrant does not accord with the preset number range of the quadrant, determining that the binarized video frame image does not contain the watermark.
In some embodiments, the determining module is specifically configured to: if the binarized video frame images corresponding to the video frame images of the previous m frames in the video frame sequence do not contain watermarks, determining that the video file does not contain watermarks; if at least two binarized video frame images corresponding to n frames of video frame images in the video frame sequence contain watermarks, determining that the video file contains watermarks; wherein m and n are preset detection thresholds, and n is more than or equal to 1 and less than m and less than the preset quantity.
In some embodiments, the convolution module comprises: the matrix conversion unit is used for respectively converting the binarized watermark image and the binarized video frame image into a watermark matrix and a video frame matrix; and the convolution operation unit is used for carrying out convolution operation on the video frame matrix according to a preset moving direction and step length by taking the watermark matrix as a convolution kernel to obtain a convolution result matrix.
Fig. 3 is a schematic hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 3, the electronic device may include: a memory 301 for storing program instructions; and the processor 302 is configured to call and execute the program instructions in the memory, so as to implement the method for detecting a video watermark.
In this embodiment, the processor and the memory may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present application. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
In a specific implementation, the present application further provides a computer storage medium, where the computer storage medium may store a computer program, where when the computer program is executed by at least one processor of a video watermark detection apparatus, the video watermark detection apparatus performs some or all of the steps in each embodiment of the video watermark detection method of the present application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
It will be apparent to those skilled in the art that the techniques of embodiments of the present application may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present application.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the apparatus, electronic device and storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments where relevant.
The embodiments of the present application described above do not limit the scope of the present application.

Claims (10)

1. A method for detecting a video watermark, the method comprising:
acquiring a preset number of binarized video frame images from a video file;
acquiring a binarized watermark image, carrying out convolution operation on the binarized video frame image by taking the binarized watermark image as a convolution check to obtain a convolution result matrix, and determining a target sub-block in the binarized video frame image, wherein the convolution result matrix comprises at least one convolution result, each convolution result corresponds to one sub-block in the binarized video frame image, and the target sub-block is a sub-block corresponding to the maximum convolution result in the convolution result matrix;
judging whether the binarized video frame image contains a watermark or not by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block;
determining whether the video file contains a watermark according to a judging result corresponding to part or all of the binarized video frame images;
the step of judging whether the binarized video frame image contains the watermark by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block comprises the following steps:
counting the number of pixels falling into each preset quadrant according to the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block, wherein the preset quadrant comprises a quadrant A, a quadrant B, a quadrant C and a quadrant D, the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant A are respectively 1 and 1, the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant B are respectively 0 and 1, the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant C are respectively 1 and 0, and the binarized pixel values of the pixels at the corresponding positions of the binarized watermark image and the target sub-block in the quadrant D are respectively 0 and 0; judging whether the number of pixel points falling into each quadrant accords with the preset number range of the quadrants; if the number of pixel points falling into each quadrant accords with the preset number range of the quadrants, determining that the binarized video frame image contains watermarks; and if the number of the pixel points falling into at least one quadrant does not accord with the preset number range of the quadrant, determining that the binarized video frame image does not contain the watermark.
2. The method of claim 1, wherein the acquiring the binarized watermark image comprises:
obtaining a watermark image, and performing edge detection processing on the watermark image to obtain an edge watermark image;
performing binarization processing on the marginalized watermark image to obtain the binarized watermark image;
the method comprises the steps of obtaining a preset number of binarized video frame images from a video file:
acquiring a video frame sequence from a video file, wherein the video frame sequence comprises a preset number of video frame images;
performing edge detection on the preset number of video frame images to obtain the preset number of video frame edge images;
and carrying out binarization processing on the preset number of video frame edge images to obtain the preset number of binarized video frame images.
3. The method according to claim 2, wherein determining whether the video file contains a watermark according to the determination result corresponding to part or all of the binarized video frame images comprises:
if the binarized video frame images corresponding to the video frame images of the previous m frames in the video frame sequence do not contain watermarks, determining that the video file does not contain watermarks;
if at least two binarized video frame images corresponding to n frames of video frame images in the video frame sequence contain watermarks, determining that the video file contains watermarks;
wherein m and n are preset detection thresholds, and n is more than or equal to 1 and less than m and less than the preset quantity.
4. The method according to claim 2, wherein convolving the binarized watermark image with the binarized video frame image comprises:
converting the binarized watermark image and the binarized video frame image into a watermark matrix and a video frame matrix respectively;
and taking the watermark matrix as a convolution kernel, and carrying out convolution operation on the video frame matrix according to a preset moving direction and step length to obtain a convolution result matrix.
5. A device for detecting a video watermark, the device comprising:
the acquisition module is used for acquiring a preset number of binarized video frame images from the video file and acquiring binarized watermark images;
the convolution module is used for carrying out convolution operation on the binarized video frame image by taking the binarized watermark image as a convolution check to obtain a convolution result matrix, determining a target sub-block in the binarized video frame image, wherein the convolution result matrix comprises at least one convolution result, each convolution result corresponds to one sub-block in the binarized video frame image, and the target sub-block is a sub-block corresponding to the maximum convolution result in the convolution result matrix;
the judging module is used for judging whether the binarized video frame image contains a watermark or not by comparing the binarized watermark image with the binarized pixel value of the pixel point at the corresponding position of the target sub-block;
the determining module is used for determining whether the video file contains a watermark according to the judging result corresponding to part or all of the binarized video frame images;
the judging module comprises:
a statistics unit, configured to count, according to binarized pixel values of pixel points at corresponding positions of the binarized watermark image and the target sub-block, the number of pixel points falling into each preset quadrant, where the preset quadrant includes a quadrant a, a quadrant B, a quadrant C, and a quadrant D, the binarized pixel values of pixel points at corresponding positions of the binarized watermark image and the target sub-block in the quadrant a are respectively 1 and 1, the binarized pixel values of pixel points at corresponding positions of the binarized watermark image and the target sub-block in the quadrant B are respectively 0 and 1, the binarized pixel values of pixel points at corresponding positions of the binarized watermark image and the target sub-block in the quadrant C are respectively 1 and 0, and the binarized pixel values of pixel points at corresponding positions of the binarized watermark image and the target sub-block in the quadrant D are respectively 0 and 0;
the judging unit is used for judging whether the number of the pixel points falling into each quadrant accords with the number range preset by the quadrant; if the number of pixel points falling into each quadrant accords with the preset number range of the quadrants, determining that the binarized video frame image contains watermarks; and if the number of the pixel points falling into at least one quadrant does not accord with the preset number range of the quadrant, determining that the binarized video frame image does not contain the watermark.
6. The apparatus of claim 5, wherein the acquisition module comprises:
the first acquisition unit is used for acquiring a watermark image, and carrying out edge detection processing on the watermark image to obtain an edge watermark image; performing binarization processing on the marginalized watermark image to obtain the binarized watermark image; the method comprises the steps of obtaining a preset number of binarized video frame images from a video file:
the second acquisition unit is used for acquiring a video frame sequence from the video file, wherein the video frame sequence comprises a preset number of video frame images; performing edge detection on the preset number of video frame images to obtain the preset number of video frame edge images; and carrying out binarization processing on the preset number of video frame edge images to obtain the preset number of binarized video frame images.
7. The apparatus of claim 6, wherein the determining module is specifically configured to:
if the binarized video frame images corresponding to the video frame images of the previous m frames in the video frame sequence do not contain watermarks, determining that the video file does not contain watermarks;
if at least two binarized video frame images corresponding to n frames of video frame images in the video frame sequence contain watermarks, determining that the video file contains watermarks;
wherein m and n are preset detection thresholds, and n is more than or equal to 1 and less than m and less than the preset quantity.
8. The apparatus of claim 6, wherein the convolution module comprises:
the matrix conversion unit is used for respectively converting the binarized watermark image and the binarized video frame image into a watermark matrix and a video frame matrix;
and the convolution operation unit is used for carrying out convolution operation on the video frame matrix according to a preset moving direction and step length by taking the watermark matrix as a convolution kernel to obtain a convolution result matrix.
9. An electronic device, comprising:
a memory for storing program instructions;
a processor for invoking and executing program instructions in said memory to implement the method of any of claims 1-4.
10. A storage medium having stored therein a computer program which, when executed by at least one processor of an apparatus according to any of claims 5-8, performs the method according to any of claims 1-4.
CN202010212767.6A 2020-03-24 2020-03-24 Video watermark detection method, device, electronic equipment and storage medium Active CN111445376B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010212767.6A CN111445376B (en) 2020-03-24 2020-03-24 Video watermark detection method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010212767.6A CN111445376B (en) 2020-03-24 2020-03-24 Video watermark detection method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111445376A CN111445376A (en) 2020-07-24
CN111445376B true CN111445376B (en) 2023-08-18

Family

ID=71652459

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010212767.6A Active CN111445376B (en) 2020-03-24 2020-03-24 Video watermark detection method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111445376B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112102141B (en) * 2020-09-24 2022-04-08 腾讯科技(深圳)有限公司 Watermark detection method, watermark detection device, storage medium and electronic equipment
CN112419132A (en) * 2020-11-05 2021-02-26 广州华多网络科技有限公司 Video watermark detection method and device, electronic equipment and storage medium
CN114513680B (en) * 2021-12-28 2023-04-28 上海瑞家信息技术有限公司 Video processing method, device, apparatus and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567353A (en) * 2003-06-13 2005-01-19 上海师范大学 Method for embedding watermark to and extracting watermark from binary image
US6983056B1 (en) * 1999-08-06 2006-01-03 International Business Machines Corporation Method and device for embedding and detecting watermarking information into a black and white binary document image
EP2410726A2 (en) * 2004-02-02 2012-01-25 Nippon Telegraph And Telephone Corporation Digital watermark detection apparatus, method and program
CN106096668A (en) * 2016-08-18 2016-11-09 携程计算机技术(上海)有限公司 The recognition methods of watermarked image and the system of identification
CN106331746A (en) * 2016-09-19 2017-01-11 北京小度互娱科技有限公司 Method and device for identifying position of watermark in video file
CN110532871A (en) * 2019-07-24 2019-12-03 华为技术有限公司 The method and apparatus of image procossing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6795565B2 (en) * 2001-03-08 2004-09-21 Sony Corporation Method to detect watermark resistant to resizing and translation
US9218638B2 (en) * 2012-03-27 2015-12-22 Infosys Limited Method, system, and computer-readable medium for embedding and extracting a watermark in a video

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6983056B1 (en) * 1999-08-06 2006-01-03 International Business Machines Corporation Method and device for embedding and detecting watermarking information into a black and white binary document image
CN1567353A (en) * 2003-06-13 2005-01-19 上海师范大学 Method for embedding watermark to and extracting watermark from binary image
EP2410726A2 (en) * 2004-02-02 2012-01-25 Nippon Telegraph And Telephone Corporation Digital watermark detection apparatus, method and program
CN106096668A (en) * 2016-08-18 2016-11-09 携程计算机技术(上海)有限公司 The recognition methods of watermarked image and the system of identification
CN106331746A (en) * 2016-09-19 2017-01-11 北京小度互娱科技有限公司 Method and device for identifying position of watermark in video file
CN110532871A (en) * 2019-07-24 2019-12-03 华为技术有限公司 The method and apparatus of image procossing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Guoyin Zhang.A Fragile Watermarking Scheme of Anti-deleting Features for 2D Vector Map.Advanced Hybrid Information Processing.2018,360-368. *

Also Published As

Publication number Publication date
CN111445376A (en) 2020-07-24

Similar Documents

Publication Publication Date Title
CN111445376B (en) Video watermark detection method, device, electronic equipment and storage medium
Tang et al. Adaptive steganalysis against WOW embedding algorithm
Wang et al. A survey of passive image tampering detection
Andriotis et al. JPEG steganography detection with Benford's Law
Alwan et al. Data embedding based on better use of bits in image pixels
CN112580668B (en) Background fraud detection method and device and electronic equipment
El-Sayed et al. New edge detection technique based on the shannon entropy in gray level images
Hou et al. Detection of hue modification using photo response nonuniformity
CN112788342A (en) Watermark information embedding method and device
Fadl et al. A proposed accelerated image copy-move forgery detection
CN111652875A (en) Video counterfeiting detection method, system, storage medium and video monitoring terminal
CN114638777A (en) Image defect detection method, device, electronic equipment and medium
KR101803066B1 (en) Integrated identification system and method for illegal copy of book
CN111144425B (en) Method and device for detecting shot screen picture, electronic equipment and storage medium
Guan et al. An effective image steganalysis method based on neighborhood information of pixels
Sari et al. The effect of error level analysis on the image forgery detection using deep learning
Yang et al. Locating secret messages based on quantitative steganalysis
CN112235305A (en) Malicious traffic detection method based on convolutional neural network
Fadl et al. Copy-rotate-move forgery detection based on spatial domain
Majercak et al. Performance evaluation of feature-based steganalysis in steganography
Xiao et al. A semi-fragile watermarking tolerant of Laplacian sharpening
Sheng et al. Robust algorithm for detection of copy-move forgery in digital images based on ridgelet transform
CN111709951A (en) Target detection network training method and system, network, device and medium
CN112396551A (en) Watermark embedding method and device
US11893094B1 (en) DCT-based watermarking scheme for deep neural networks

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