CN113015004A - Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment - Google Patents

Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment Download PDF

Info

Publication number
CN113015004A
CN113015004A CN202110275124.0A CN202110275124A CN113015004A CN 113015004 A CN113015004 A CN 113015004A CN 202110275124 A CN202110275124 A CN 202110275124A CN 113015004 A CN113015004 A CN 113015004A
Authority
CN
China
Prior art keywords
pixel value
video frame
rule
watermark
area
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.)
Granted
Application number
CN202110275124.0A
Other languages
Chinese (zh)
Other versions
CN113015004B (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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202110275124.0A priority Critical patent/CN113015004B/en
Publication of CN113015004A publication Critical patent/CN113015004A/en
Application granted granted Critical
Publication of CN113015004B publication Critical patent/CN113015004B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/835Generation of protective data, e.g. certificates
    • H04N21/8358Generation of protective data, e.g. certificates involving watermark

Abstract

The embodiment of the invention provides an identification method, a production method, a device and electronic equipment of a watermark video frame, wherein the identification method comprises the following steps: acquiring a video to be detected; detecting each video frame to be detected in a video to be detected, and determining whether the video frame contains a preset pixel value adjusting area; the pixel value adjustment area is: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule includes: the change rule of the pixel value among all the pixel values in the pixel value adjusting area is adjusted; and determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark. The embodiment of the invention can automatically identify the video frame containing the watermark from the video, thereby improving the efficiency.

Description

Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a method, a device, and an electronic device for identifying a watermark video frame.
Background
Currently, many internet companies start to make videos by themselves or by purchasing royalties for a certain video and play the videos on the video websites of the companies. Generally, in order to prevent a user from recording or recording a screen during watching a video, when the user plays the video, a video frame may be selected from the played video and a watermark may be added, where the watermark includes user information. When the suspected embezzled video is found, the embezzled user can be determined by identifying the watermark in the suspected embezzled video. In order to improve the concealment of the watermark and prevent a user from finding the watermark when watching a video, the watermark can be encrypted in the process of adding the watermark in a video frame.
In the prior art, a manual identification method is usually adopted to identify each video frame in a suspected embezzled video one by one, identify the video frame containing the watermark, then identify the watermark from the video frame, and further determine user information. The method for artificially identifying the video frame added with the watermark has low identification efficiency.
Moreover, since the watermark may be encrypted during the process of adding the watermark to the video frame, the difficulty of identifying the encrypted watermark will be increased. That is to say, if the watermark added in the video frame is an encrypted watermark, the difficulty of identifying the video frame containing the encrypted watermark will be further increased, and the efficiency of manual identification is lower.
Disclosure of Invention
Embodiments of the present invention provide a method, a device, and an electronic device capable of identifying a video frame containing a watermark from a video, so as to automatically identify the video frame containing the watermark from the video and improve efficiency. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, a method for identifying a watermark video frame is provided, where the method includes:
acquiring a video to be detected;
detecting each video frame to be detected in the video to be detected, and determining whether the video frame contains a preset pixel value adjusting area; the pixel value adjustment area is as follows: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule comprises: the change rule of the pixel value among all the pixel values in the pixel value adjusting area is adjusted;
and determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark.
Optionally, the pixel value adjustment area specifically includes: and aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule, and then conforming to the region of the target pixel value rule.
Optionally, the step of detecting each video frame to be detected in the video to be detected and determining whether the video frame includes a preset pixel value adjustment region includes:
extracting gradient characteristics of each video frame to be detected;
each element in the gradient signature represents: the size relation between the pixel value of the pixel with the same position as the element in the video frame to be detected and the pixel value of the adjacent pixel;
judging whether each pixel value in the video frame to be detected accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient characteristics of the video frame to be detected;
and if so, the video frame to be detected comprises a preset pixel value adjusting area.
Optionally, the target pixel value rule further includes: adjusting the size of the area by the pixel value;
before the step of extracting the gradient feature of each video frame to be detected, the method further includes:
traversing each video frame to be detected based on the size of a pixel value adjusting area included in the target pixel value rule to obtain a plurality of regions to be determined, wherein the region size of each region to be determined is the size of the pixel value adjusting area in the video frame to be detected;
the step of detecting each video frame to be detected in the video to be detected and determining whether the video frame contains a preset pixel value adjustment area includes:
extracting gradient features of the regions to be determined aiming at each region to be determined; each element in the gradient feature of the region to be localized represents: the size relationship between the pixel value of the pixel with the same position as the element in the undetermined area and the pixel value of the adjacent pixel;
judging whether each pixel value in the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient feature of the undetermined area;
and if the undetermined area accords with the change rule of the pixel value among all the pixel values in the pixel value adjusting area in the target pixel value rule, the video frame where the undetermined area is located comprises a preset pixel value adjusting area.
Optionally, in the target pixel value rule, a rule of change in pixel value between pixel values in the pixel value adjustment region includes: a first proportion of pixels with increased values compared to adjacent pixel values to total pixels of the pixel value adjustment region and a second proportion of pixels with decreased values compared to adjacent pixel values to total pixels of the pixel value adjustment region;
the gradient characteristic of the region to be determined comprises: the pixel value of each pixel is increased or decreased by the corresponding mark compared with the adjacent pixel value;
the step of judging whether each pixel value in the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient feature of the undetermined area comprises the following steps:
counting a third proportion of pixels which are increased compared with the adjacent pixel values in the pixel value adjustment area and a fourth proportion of pixels which are decreased compared with the adjacent pixel values in the pixel value adjustment area based on the identification that the pixel values of all the pixels are increased or decreased compared with the adjacent pixel values in the gradient feature;
judging whether the difference value between the counted third proportion and the first proportion is smaller than or equal to a first preset threshold value or not, if so, determining that the region to be determined accords with the change rule of the pixel value among the pixel values in the pixel value adjusting region in the target pixel value rule;
or judging whether the difference value between the counted fourth proportion and the second proportion is smaller than or equal to a second preset threshold value, if so, enabling the region to be determined to accord with the change rule of the pixel value among the pixel values in the pixel value adjusting region in the target pixel value rule.
Optionally, the target pixel value rule further includes: the arrangement order of the pixels in the pixel value adjustment region, in which the pixel value is increased compared with the adjacent pixel value, and the pixels in the pixel value adjustment region, in which the pixel value is decreased compared with the adjacent pixel value;
the step of judging whether the absolute value of the difference between the third ratio and the first ratio is smaller than or equal to a first preset threshold value, if so, the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule, and the step includes:
judging whether the absolute value of the difference between the third proportion and the first proportion is smaller than or equal to the first preset threshold, if so, judging whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of all the pixels conforms to the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule;
the step of judging whether the absolute value of the difference between the counted fourth proportion and the second proportion is smaller than or equal to a second preset threshold value, if so, the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule, and the step includes the following steps:
and judging whether the absolute value of the difference between the fourth proportion and the second proportion is less than or equal to the first preset threshold, if so, judging whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of all the pixels conforms to the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule.
Optionally, for any pixel, the adjacent pixel of the pixel is located in the same horizontal direction or the same vertical direction as the pixel.
Optionally, after the step of determining, according to the gradient feature of the to-be-determined region, whether each pixel value in the to-be-determined region meets the target pixel value rule or not, and adjusting a change rule of pixel values between each pixel value in the region by a pixel value, the method further includes:
and if each undetermined area does not accord with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule, selecting one pixel value rule from a plurality of pixel value rules acquired in advance, determining the pixel value rule as the target pixel value rule, and returning to the step of judging whether each pixel value in each undetermined area accords with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient characteristic of each undetermined area.
Optionally, after the step of determining the video frame to be detected containing the preset pixel value adjustment region as the video frame added with the watermark, the method further includes:
and outputting and displaying the video frame added with the watermark.
Optionally, the target pixel value rule further includes: adjusting the relative position relationship between the pixel value adjusting area and the watermark area;
after the step of determining the video frame to be detected containing the preset pixel value adjustment area as the video frame added with the watermark, the method further comprises:
determining the watermark region based on the relative position relationship between the pixel value adjustment region and the watermark region and the pixel value adjustment region;
and highlighting the watermark area.
In a second aspect of the embodiments of the present invention, a method for producing a watermarked video frame is provided, where the method includes:
acquiring an operation request of a video to be processed;
selecting a video frame to be processed from the video to be processed;
adding a target watermark into the video frame to be processed to obtain a video frame added with the watermark;
aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable a pixel value adjusting area obtained after adjustment to accord with the target pixel value rule, wherein the target pixel value rule comprises: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
Optionally, the target pixel value rule further includes: adjusting the relative position relationship between the pixel value adjusting area and the watermark area;
before the step of adding the target watermark to the video frame to be processed to obtain the watermarked video frame, the method further includes:
determining a watermark region from the video frame to be processed, wherein the watermark region is a region for adding a target watermark;
determining a region to be adjusted from the video frame to be processed according to the watermark region, the relative position relationship between the pixel value adjusting region and the watermark region and the size of the pixel value adjusting region in the target pixel value rule, wherein the region to be adjusted is a region for adjusting the pixel value;
alternatively, the first and second electrodes may be,
determining a region to be adjusted from a video frame to be processed based on the size of the pixel value adjustment region in the target pixel value rule;
and determining the watermark region according to the region to be adjusted and the relative position relationship between the pixel value adjustment region and the watermark region.
Optionally, the target pixel value rule further includes: in the pixel value adjusting area, pixels with values increased compared with adjacent pixels account for a first proportion of total pixels of the pixel value adjusting area, and pixels with values decreased compared with adjacent pixels account for a second proportion of total pixels of the pixel value adjusting area;
the step of adjusting the pixel value in the video frame based on the target pixel value rule aiming at the video frame added with the watermark so as to make the pixel value adjustment area obtained after adjustment accord with the target pixel value rule comprises the following steps:
generating a feature matrix according to the first proportion, the second proportion and the size of a pixel value adjusting region in the target pixel value rule; each element in the feature matrix represents: in the pixel value adjustment region, the magnitude relation between the pixel value of the pixel having the same position as the element and the pixel value of the adjacent pixel;
traversing each pixel in the area to be adjusted, and judging whether the size relationship between the pixel value of the pixel and the pixel value of the adjacent pixel corresponds to an element in the characteristic matrix; and if not, increasing or decreasing the pixel value of the pixel according to the feature matrix.
Optionally, the target pixel value rule further includes: the arrangement order of the pixels in the pixel value adjustment region, in which the pixel value is increased compared with the adjacent pixel value, and the pixels in the pixel value adjustment region, in which the pixel value is decreased compared with the adjacent pixel value;
the step of generating a feature matrix according to the first proportion, the second proportion and the size of the pixel value adjustment region in the target pixel value rule includes:
and generating a feature matrix according to the first proportion, the second proportion, the arrangement sequence in the target pixel value rule and the size of a pixel value adjusting area in the target pixel value rule.
Optionally, before the step of adjusting, for the watermarked video frame, pixel values in the video frame based on a target pixel value rule so that a pixel value adjustment area obtained after the adjustment meets the target pixel value rule, the method further includes:
acquiring a plurality of pixel value rules and version information corresponding to each pixel value rule;
and selecting the pixel value rule with the latest version information from the plurality of pixel value rules, and determining the pixel value rule as the target pixel value rule.
Optionally, the step of adding the target watermark to the video frame to be processed to obtain a watermarked video frame includes:
acquiring the area pixel value of each pixel in the watermark area; acquiring watermark pixel values of all pixels in the target watermark;
calculating a first product between the region pixel value and a first preset weight coefficient; and calculating a second product between the watermark pixel value and a second preset weight coefficient;
calculating the sum of the first product and the second product as a target pixel value;
updating the pixel values of the pixels in the watermark region to the target pixel values.
Optionally, the operation request includes: a play request, an upload request, or a publish request.
In a third aspect of the embodiments of the present invention, an apparatus for identifying a watermark video frame is provided, where the apparatus includes:
the to-be-detected video acquisition module is used for acquiring a to-be-detected video;
the video frame detection module to be detected is used for detecting each video frame to be detected in the video to be detected and determining whether the video frame contains a preset pixel value adjustment area; the pixel value adjustment area is as follows: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule comprises: the change rule of the pixel value among all the pixel values in the pixel value adjusting area is adjusted;
and the video frame determining module is used for determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark.
In a fourth aspect of the embodiments of the present invention, there is provided a device for producing a watermarked video frame, the device including:
the operation request acquisition module is used for acquiring an operation request of a video to be processed;
the video frame selection module to be processed is used for selecting video frames to be processed from the videos to be processed;
the target watermark adding module is used for adding a target watermark into the video frame to be processed to obtain a video frame added with the watermark;
a pixel value adjusting module, configured to adjust, for the video frame with the watermark added, a pixel value in the video frame based on a target pixel value rule, so that a pixel value adjustment area obtained after adjustment meets the target pixel value rule, where the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
In a fifth aspect of the embodiments of the present invention, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the method for identifying a watermarked video frame according to any one of the first aspect described above when executing a program stored in a memory.
In a sixth aspect of the embodiments of the present invention, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the production method of the watermark video frame provided by the second aspect when executing the program stored in the memory.
A seventh aspect of the embodiments of the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method for identifying a watermarked video frame according to any one of the above first aspects.
In an eighth aspect of the embodiments of the present invention, there is provided a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method for producing a watermarked video frame according to any one of the second aspects.
The embodiment of the invention has the following beneficial effects:
according to the identification method, the production method, the device and the electronic equipment of the watermark video frame, provided by the embodiment of the invention, the video to be detected is obtained; and detecting each video frame to be detected in the video to be detected, and determining whether the video frame contains a preset pixel value adjusting area, wherein the pixel value adjusting area is an area which accords with the target pixel value rule after adjusting the pixel value in the video frame added with the watermark in advance. Therefore, when the video frame including the pixel value adjustment region is identified from the video to be detected, the video frame is the video frame added with the watermark, that is, the video frame to be detected including the preset pixel value adjustment region can be determined as the video frame added with the watermark. Therefore, the embodiment of the invention can automatically identify the video frame containing the watermark from the video to be detected.
The identification method, the production method, the device and the electronic equipment of the watermark video frame provided by the embodiment of the invention are used for acquiring the operation request of a video to be processed; selecting a video frame to be processed from a video to be processed; adding the target watermark into the video frame to be processed to obtain the video frame added with the watermark; aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable a pixel value adjusting area obtained after adjustment to accord with the target pixel value rule, wherein the target pixel value rule comprises: the size of the pixel value adjusting area and the change rule of the pixel value size among the pixel values in the pixel value adjusting area. The method comprises the steps that the pixel value in a video frame added with the watermark is adjusted based on a target pixel value rule aiming at the video frame added with the watermark, so that an adjusted pixel value adjusting area obtained after adjustment accords with the target pixel value rule, the video frame added with the watermark also comprises the pixel value adjusting area, and in the process of identifying the watermark video frame, the video frame comprising the pixel value adjusting area can be identified from a video to be detected, and the video frame is the video frame comprising the target watermark.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
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, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1 is a first flowchart of a method for identifying a watermarked video frame according to an embodiment of the present invention;
fig. 2a is a specific flow of S102 in the method for identifying a watermark video frame shown in fig. 1;
fig. 2b is another specific flow of S102 in the method for identifying a watermark video frame shown in fig. 1;
fig. 3 is a specific flow of S207 in the method for identifying a watermark video frame shown in fig. 2 b;
fig. 4 is a second flowchart of a method for identifying a watermarked video frame according to an embodiment of the present invention;
fig. 5a is a third flowchart illustrating an identification method of a watermarked video frame according to an embodiment of the present invention;
fig. 5b is a fourth flowchart illustrating an identification method of a watermarked video frame according to an embodiment of the present invention;
fig. 5c is a schematic diagram of a video frame with added watermark according to an embodiment of the present invention;
fig. 6 is a first flowchart of a method for producing a watermarked video frame according to an embodiment of the present invention;
fig. 7 is a second flowchart of a method for producing a watermarked video frame according to an embodiment of the present invention;
fig. 8 is a third flowchart illustrating a method for producing a watermarked video frame according to an embodiment of the present invention;
fig. 9 is a detailed flow of S604 in the method for producing a watermarked video frame shown in fig. 6;
fig. 10 is a fourth flowchart illustrating a method for producing a watermarked video frame according to an embodiment of the present invention;
fig. 11 is a detailed flow of S603 in the method for producing a watermarked video frame shown in fig. 6;
fig. 12 is a schematic structural diagram of an apparatus for identifying a watermarked video frame according to an embodiment of the present invention;
fig. 13 is a schematic structural diagram of an apparatus for generating a watermark video frame according to an embodiment of the present invention;
fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 15 is another schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, a manual identification method is usually adopted to identify each video frame in a suspected embezzled video one by one, identify the video frame containing the watermark, then identify the watermark from the video frame, and further determine user information. The method for artificially identifying the video frame added with the watermark has low identification efficiency.
Moreover, since the watermark may be encrypted during the process of adding the watermark to the video frame, the difficulty of identifying the encrypted watermark will be increased. That is to say, if the watermark added in the video frame is an encrypted watermark, the difficulty of identifying the video frame containing the encrypted watermark will be further increased, and the efficiency of manual identification is lower.
In view of this, embodiments of the present invention provide an identification method, a production method, an apparatus, and an electronic device for a watermark video frame, and in general, in a production process of the watermark video frame: acquiring an operation request of a video to be processed; selecting a video frame to be processed from a video to be processed; adding the target watermark into the video frame to be processed to obtain the video frame added with the watermark; and aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable the pixel value adjusting area obtained after adjustment to accord with the target pixel value rule. In the identification process of the watermark video frame: acquiring a video to be detected; detecting each video frame to be detected in a video to be detected, and determining whether the video frame contains a preset pixel value adjusting area; and determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark so as to automatically identify the video frame containing the watermark from the video.
It should be noted that the identification method and the production method of the watermark video frame provided by the embodiment of the present invention can be applied to an electronic device with information processing capability, such as a terminal where a server or a client is located. However, for convenience of description, the following describes an embodiment of the present invention in detail by taking an example in which the method for identifying a watermark video frame is applied to a server and the method for producing a watermark video frame is applied to a client.
As shown in fig. 1, an embodiment of the present invention provides a method for identifying a watermarked video frame, where the method may include:
and S101, acquiring a video to be detected.
S102, detecting each video frame to be detected in a video to be detected, and determining whether the video frame contains a preset pixel value adjusting area; the pixel value adjustment area is: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
S103, determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark.
The method for identifying the watermark video frame provided by the embodiment of the invention comprises the steps of acquiring a video to be detected; and detecting each video frame to be detected in the video to be detected, and determining whether the video frame contains a preset pixel value adjusting area, wherein the pixel value adjusting area is an area which accords with the target pixel value rule after adjusting the pixel value in the video frame added with the watermark in advance. Therefore, when the video frame including the pixel value adjustment region is identified from the video to be detected, the video frame is the video frame added with the watermark, that is, the video frame to be detected including the preset pixel value adjustment region can be determined as the video frame added with the watermark. Therefore, the embodiment of the invention can automatically identify the video frame containing the watermark from the video to be detected.
Further, in step S101 of the flow of the embodiment shown in fig. 1, the video to be detected may be a video suspected to be illegally played, for example, a video that is not allowed to be played in some specific websites or video APPs (applications). The videos are usually recorded and played by other video recording devices during the watching process of a user, or are recorded and obtained through a terminal where the video APP is located, and then are streamed to some specific websites or video APPs, and the videos may be called as videos to be detected.
Further, in step S102 of the flow of the embodiment shown in fig. 1, after the video to be detected is acquired, each video frame to be detected in the video to be detected may be detected one by one, and it is determined whether the video frame to be detected includes a preset pixel value adjustment area. Since the pixel value adjustment region is: the area that conforms to the target pixel value rule after adjusting the pixel values in the video frame based on the target pixel value rule, and the to-be-detected video frame including the pixel value adjustment area is also added with the watermark, and the pixel value adjustment area may specifically be an area that conforms to the target pixel value rule after adjusting the pixel values in the video frame based on the target pixel value rule for the video frame to which the watermark is added. Therefore, when the video frame containing the pixel value adjustment area is identified from the video to be detected, the video frame is the video frame containing the watermark.
In this embodiment, the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted. The change rule of the pixel value between the pixel values in the pixel value adjusting region may include: the size relationship between the pixel values of two adjacent pixels, or the pixel values of the pixels from left to right in the same row gradually increase and gradually decrease, or the number of the pixel values increasing or decreasing, etc.
Further, in step S103 of the flow of the embodiment shown in fig. 1, in the process of adjusting the pixel value, the pixel value in the video frame to which the watermark is added may be adjusted based on the target pixel value rule to obtain the pixel value adjustment area, so that the video frame includes both the watermark and the pixel value adjustment area. Therefore, when the video frame to be detected contains the pixel value adjustment area, it indicates that the watermark is added to the video frame to be detected, and the video frame to be detected containing the preset pixel value adjustment area can be determined as the video frame to be added with the watermark.
In the specific watermark extraction process, after a plurality of frames of video added with watermarks are determined from the video to be detected, the watermarks can be identified through manual repeated comparison.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 2a, step S102 in the embodiment shown in fig. 1, which detects each to-be-detected video frame in a to-be-detected video, and determines whether the video frame includes a preset pixel value adjustment area, may include:
s201, extracting gradient characteristics of each video frame to be detected.
In the embodiment of the present invention, all pixel values in a video frame may be adjusted to obtain a pixel value adjustment area, and the size of the pixel value adjustment area is the same as the size of the video frame. Thus, in this case, it is possible to extract the gradient features of the respective video frames to be detected, each element of the gradient features representing: and the size relation between the pixel value of the pixel with the same position as the element in the video frame to be detected and the pixel value of the adjacent pixel.
S202, judging whether each pixel value in the video frame to be detected accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient characteristics of the video frame to be detected.
Because the gradient feature can represent the magnitude relation between each pixel value and the adjacent pixel value in the video frame to be detected, after the gradient feature of each video frame to be detected is obtained, whether each pixel value in each video frame to be detected meets the change rule of the pixel value among the pixel values in the pixel value adjusting area or not can be judged.
It should be noted that, for any pixel, the adjacent pixel of the pixel and the pixel are located in the same horizontal direction or the same vertical direction, and the adjacent pixel of the pixel may be a previous pixel or a next pixel of the pixel.
And S203, if so, the video frame to be detected comprises a preset pixel value adjusting area.
And S204, if not, the video frame to be detected does not contain a preset pixel value adjusting area.
In the embodiment of the invention, the video frame to be detected which accords with the change rule of the pixel value between the pixel values in the pixel value adjusting area in the target pixel value rule is obtained by extracting the gradient characteristic of each video frame to be detected and according to whether the video frame to be detected accords with the change rule of the pixel value between the pixel values in the pixel value adjusting area in the target pixel value rule. Because the gradient feature can well represent the change rule of the pixel value among the pixel values in the pixel adjustment area, the embodiment of the invention can more accurately judge whether the video frame to be detected contains the pixel value adjustment area or not based on the gradient feature.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the pixel values adjust the size of the region. The size of the pixel value adjustment region may include: the length and width of the pixel value adjusting area, and the size of the pixel value adjusting area can be set according to actual needs, for example, it can be set to be the same as the size of the video frame; it may also be set smaller than the size of the video frame, e.g., 300 × 300 or 400 × 400, etc.
As shown in fig. 2b, in step S102 of the embodiment shown in fig. 1, the step of detecting each video frame to be detected in the video to be detected and determining whether the video frame includes the preset pixel value adjustment area may include:
s205, traversing each video frame to be detected based on the size of the pixel value adjusting area included in the target pixel value rule to obtain a plurality of regions to be determined, wherein the size of the region is the size of the pixel value adjusting area, in the video frame to be detected.
For each video frame to be detected, a plurality of regions to be determined whose region sizes are the pixel value adjustment regions can be obtained from the video frame to be detected. Specifically, each pixel of the video frame to be detected may be traversed from top to bottom and from left to right, the pixel is used as the top left corner vertex of the to-be-detected region, the to-be-detected region is obtained, and until when a certain pixel is used as the top left corner vertex, the size of the region that can be selected is smaller than the size of the pixel value adjustment region, so that a plurality of to-be-detected regions may be obtained for each video frame to be detected.
For example, when the length and the width of the to-be-determined region are both 300 and the length and the width of the to-be-detected video frame are both 400, regarding the pixel in the first row and the first column in the to-be-detected video frame, the pixel can be taken as the top left corner vertex, and the to-be-determined region can be determined to be a region surrounded by the pixel in the first row and the first column, the pixel in the first row and the 300 th column, the pixel in the 300 th row and the 1 st column, and the pixel in the 300 th row and the 300 th column. For the pixel in the row 301 and the column 1, if the pixel is taken as the top left corner vertex, the maximum width that can be determined is 200, which is smaller than the width of the pixel value adjustment area, so that the pixel cannot be taken as the top left corner vertex to select the undetermined area.
S206, aiming at each undetermined area, extracting the gradient characteristics of the undetermined area.
Extracting the gradient feature of the region to be determined aiming at each region to be determined, wherein each element in the gradient feature of the region to be determined represents: and the size relation between the pixel value of the pixel with the same position as the element in the region to be determined and the pixel value of the adjacent pixel.
The gradient characteristics of each region to be determined can be extracted by the following method:
the method comprises the steps of firstly, traversing each pixel in each to-be-determined area aiming at each to-be-determined area, and judging the size relation between the pixel value of each pixel and the pixel value of the adjacent pixel.
And secondly, acquiring a first identifier or a second identifier corresponding to each pixel according to different judgment results.
According to different judgment results, a first identifier or a second identifier corresponding to each pixel can be obtained, wherein the pixel value of the pixel corresponding to the first identifier is larger than that of the adjacent pixel, and the pixel value of the pixel corresponding to the second identifier is smaller than that of the adjacent pixel. That is, when the judgment result is greater than the first threshold, the identifier corresponding to the pixel is the first identifier; and when the judgment result is less than the first threshold, the mark corresponding to the pixel is a second mark. Specifically, for example, the first flag may be 1, and the second flag may be 0.
And thirdly, forming the first mark or the second mark corresponding to each pixel into gradient characteristics.
After the first identifier or the second identifier corresponding to each pixel in the region to be determined is obtained, the first identifier or the second identifier may be composed into a gradient feature according to the length and the width of the region to be determined. The length of the gradient feature is the same as that of the region to be determined, and the width of the gradient feature is the same as that of the region to be determined.
To further improve the accuracy of identification of video frames containing watermarks, the gradient features may include: a horizontal gradient feature and a vertical gradient feature.
The horizontal gradient feature of each region to be determined can be extracted by the following method:
and traversing each pixel of the undetermined area line by line aiming at each undetermined area, and judging the size relationship between the pixel value of each pixel and the pixel values of adjacent pixels in the same line. Generating a third identifier or a fourth identifier corresponding to each pixel according to different judgment results; and forming the third mark or the fourth mark corresponding to each pixel into a horizontal gradient feature. Specifically, for example, the third flag may be 1, and the fourth flag may be 0.
The vertical gradient feature of each region to be determined can be extracted by the following method:
and traversing each pixel of the to-be-determined area column by column aiming at each to-be-determined area, and judging the size relationship between the pixel value of each pixel and the pixel value of the adjacent pixel in the same column. And generating a fifth identifier or a sixth identifier corresponding to each pixel according to different judgment results. And forming the vertical gradient feature by using the fifth mark or the sixth mark corresponding to each pixel. Specifically, for example, the fifth flag may be 1, and the sixth flag may be 0. It should be noted that the above method for extracting the gradient feature of the to-be-determined region is also applicable to the process of extracting the gradient feature of the to-be-detected video frame.
And S207, judging whether each pixel value in the region to be determined accords with the change rule of the pixel value among the pixel values in the pixel value adjusting region in the target pixel value rule or not according to the gradient characteristic of the region to be determined.
Because the gradient feature can represent the magnitude relation between each pixel value and the adjacent pixel value in the undetermined area, after the gradient feature of each undetermined area is obtained, whether each pixel value in each undetermined area meets the target pixel value rule or not can be judged, and the change rule of the magnitude of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
When the gradient features comprise horizontal gradient features and vertical gradient features, whether each pixel value in each region to be determined meets the change rule of the pixel value among the pixel values in the target pixel value rule or not needs to be judged according to the horizontal gradient features; and judging whether each pixel value in each region to be determined accords with the change rule of the pixel value among the pixel values in the pixel value adjusting region in the target pixel value rule or not according to the vertical gradient characteristics. When each pixel value in each region to be determined is judged to be in accordance with the change rule of the pixel value among the pixel values in the pixel value adjusting region in the target pixel value rule according to the horizontal gradient feature and the vertical gradient feature, the fact that the region to be determined is in accordance with the change rule of the pixel value among the pixel values in the pixel value adjusting region in the target pixel value rule is shown.
In the embodiment of the invention, the horizontal gradient feature is generated according to the size relationship between the pixel value of each pixel in the same row and the pixel value of the adjacent pixel, the vertical gradient feature is generated according to the size relationship between the pixel value of each pixel in the same column and the pixel value of the adjacent pixel, and when the region to be determined is judged to meet the target pixel value rule according to the horizontal gradient feature and the vertical gradient feature, the video frame where the region to be determined is judged to meet the target pixel value rule, so that the identification difficulty of the pixel value adjusting region is increased, the identification difficulty of the watermark video frame is further increased, and the watermark added in the video frame can be better avoided from being damaged.
S208, if the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule, the video frame where the undetermined area is located comprises a preset pixel value adjusting area.
It should be noted that, usually, a video frame to be detected may include a pixel value adjustment region, a plurality of regions to be determined are determined from the video frame to be detected, and it may be determined one by one whether the plurality of regions to be determined conform to the target pixel value rule, and a change rule of the pixel value between each pixel value in the pixel value adjustment region, when one of the regions to be determined conforms, it is not necessary to determine other regions to be determined, that is, the determination process is stopped, so that the calculation resources may be saved.
S209, if all the undetermined areas in the video frame to be detected do not accord with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule, the video frame where the undetermined areas are located does not contain the preset pixel value adjusting area.
In the embodiment of the invention, the video frame to be detected, in which the undetermined area meeting the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule is located, is obtained by acquiring the undetermined areas corresponding to the video frame to be detected, extracting the gradient characteristics of each undetermined area and according to whether the undetermined area meets the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, in the target pixel value rule, a rule of change in pixel value between pixel values in the pixel value adjustment region includes: a first proportion of pixels with increased values compared to adjacent pixels to total pixels of the pixel value adjustment region, and a second proportion of pixels with decreased values compared to adjacent pixels to total pixels of the pixel value adjustment region. For example, the first ratio and the second ratio are 50%, respectively, or the first ratio is 40%, the second ratio is 60%, and the like.
The gradient characteristic of the region to be determined comprises: the pixel value of each pixel is increased or decreased by the corresponding flag compared to the adjacent pixel values. The specific process of obtaining the gradient characteristic of each pending area may refer to step S206 in the flowchart shown in fig. 2 b.
As shown in fig. 3, step S207 of the embodiment shown in fig. 2b, according to the gradient feature of the to-be-determined region, determines whether each pixel value in the to-be-determined region meets a change rule of pixel values between each pixel value in the pixel value adjustment region in the target pixel value rule, and may include:
s301, based on the identification that the pixel value of each pixel is increased or decreased compared with the adjacent pixel value in the gradient feature, counting a third proportion of the pixels increased compared with the adjacent pixel value in the total pixels of the pixel value adjustment area and a fourth proportion of the pixels decreased compared with the adjacent pixel value in the total pixels of the pixel value adjustment area.
Since each element in the gradient feature represents a magnitude relationship between the pixel value of the pixel having the same position as the element in the region to be determined and the pixel value of the adjacent pixel, a third proportion of pixels with increased values compared to the adjacent pixel value to the total pixels in the pixel value adjustment region and a fourth proportion of pixels with decreased values compared to the adjacent pixel value to the total pixels in the pixel value adjustment region can be counted.
Specifically, since the gradient feature may include the first identifier and the second identifier, the number of the first identifiers and the number of the second identifiers in the gradient feature may be counted respectively; and counting the total element number in the gradient feature. Calculating a ratio between the first identification number and the total element number as a third ratio, and calculating a ratio between the second identification number and the total element number as a fourth ratio.
S302, whether the absolute value of the difference between the third ratio and the first ratio is smaller than or equal to a first preset threshold value is judged.
A difference between the third ratio and the first ratio may be calculated, and it is determined whether an absolute value of the calculated difference is less than or equal to a first preset threshold. For example, when the first ratio is 0.5, the length and the width of the to-be-determined region are both 300, the first number of markers is 40000, and the second number of markers is 50000, the sum of the first number of markers and the second number of markers is 90000, the first ratio is 40000/90000 ═ 0.44, and the absolute value of the difference between the third ratio and the first ratio is |0.44-0.5| -0.06. When the first preset threshold is 0.07, the difference is smaller than the first preset threshold.
And S303, if so, the undetermined area conforms to the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule.
S304, if not, the undetermined area does not accord with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule.
If the absolute value of the difference between the third proportion and the first proportion is smaller than or equal to a first preset threshold, the undetermined area is indicated to accord with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule, otherwise, the undetermined area is indicated to be not accord with the change rule of the pixel value among the pixel values in the pixel value adjusting area.
It should be noted that, in addition to determining whether the absolute value of the difference between the third ratio and the first ratio is smaller than or equal to the first preset threshold in step S302 to determine whether the to-be-determined region conforms to the change rule of the pixel values between the pixel values in the pixel value adjustment region in the target pixel value rule, it may also be determined whether the to-be-determined region conforms to the change rule of the pixel values between the pixel values in the target pixel value rule by determining whether the absolute value of the difference between the fourth ratio and the second ratio is smaller than or equal to the second preset threshold. In the above steps S301 to S304, the method for determining whether the undetermined area conforms to the target pixel value rule is simple.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule may further include: the arrangement order of the pixels in the pixel value adjustment region in which the pixel value increases compared to the adjacent pixel value and the pixels in which the pixel value decreases compared to the adjacent pixel value. For example, the order of arrangement may be: pixels having increased values compared to adjacent pixels are arranged at intervals of pixels having decreased values compared to adjacent pixels. For example, the following steps are carried out: the second pixel has an increased pixel value compared to the first pixel, the third pixel has a decreased pixel value compared to the second pixel, the fourth pixel has an increased pixel value compared to the third pixel, and so on.
In the embodiment of the process steps S302 and S303 shown in fig. 3, the step of determining whether the absolute value of the difference between the third ratio and the first ratio is smaller than or equal to a first preset threshold, if so, the undetermined area conforms to the change rule of the pixel value between the pixel values in the pixel value adjustment area in the target pixel value rule, and the step includes:
and judging whether the absolute value of the difference between the third proportion and the first proportion is less than or equal to a first preset threshold, if so, judging whether the arrangement sequence of the marks for increasing or decreasing the pixel values of each pixel compared with the adjacent pixel values accords with the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area accords with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule.
When a first proportion of pixels having increased values compared to adjacent pixels in the pixel value adjustment region to total pixels of the pixel value adjustment region and a second proportion of pixels having decreased values compared to adjacent pixels to total pixels of the pixel value adjustment region are determined, there may also be a plurality of different arrangement orders of pixels having increased values compared to adjacent pixels and pixels having decreased values compared to adjacent pixels. Therefore, when the absolute value of the difference between the third proportion and the first proportion is judged to be less than or equal to the first preset threshold, whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of the pixels meets the arrangement sequence in the target pixel value rule or not can be further judged, and if yes, the undetermined area is shown to meet the change rule in the target pixel value rule.
Judging whether the absolute value of the difference between the counted fourth proportion and the second proportion is smaller than or equal to a second preset threshold, if so, the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule, and the step comprises the following steps:
and judging whether the absolute value of the difference between the fourth proportion and the second proportion is less than or equal to a first preset threshold, if so, judging whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of all the pixels accords with the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area accords with the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule.
When the change rule of the pixel values among the pixel values in the pixel value adjusting area comprises the first proportion and the second proportion, a plurality of different arrangement orders of the pixels which are increased compared with the adjacent pixel values and the pixels which are decreased compared with the adjacent pixel values also can exist, therefore, when the absolute value of the difference value between the fourth proportion and the second proportion is judged to be less than or equal to the first preset threshold value, the arrangement order of the marks which are increased or decreased compared with the adjacent pixel values of the pixel values of all the pixels can be further judged whether to accord with the arrangement order in the target pixel value rule, and if so, the undetermined area is shown to accord with the change rule in the target pixel value rule.
As an optional implementation manner in the embodiment of the present invention, in step S207 of the embodiment flow shown in fig. 2b, before the step of determining whether each pixel value in the to-be-determined region meets the change rule of the pixel value between each pixel value in the pixel value adjustment region in the target pixel value rule according to the gradient feature of the to-be-determined region, the method for identifying a watermark video frame provided in the embodiment of the present invention may further include:
in the first step, a new pixel value rule is periodically obtained.
In order to prevent the pixel value rules from being maliciously cracked, so that the video frames added with the watermarks are maliciously identified, the pixel value rules can be updated at intervals in general; or the pixel value rule is updated after the pixel value rule is cracked. Thus, a plurality of pixel value rules are stored in the server. The new pixel value rule may be predetermined by the developer and stored in a storage server from which the server may retrieve the new pixel value rule. Of course, the new change rule may also be determined in advance for the research and development personnel and stored in the server applied in the embodiment of the present invention.
The pixel value adjusting area size, the pixel value changing rule pixel value of the pixel value between each pixel value in the pixel value adjusting area and the relative position relation between the adjusting area and the watermark area are different in different pixel value rules.
And secondly, generating new version information corresponding to the new pixel value rule based on the version information of the existing pixel value rule.
And when the server acquires one pixel value rule, generating version information for representing the sequence of the corresponding pixel value rule and other pixel value rules stored in the server. The new version information may be generated based on version information of existing pixel value rules. Specifically, the version information may be a numerical value, and may be obtained by adding a preset numerical value according to the version information of the pixel value rule obtained last time by the server, for example, adding one to the version information of the pixel value rule obtained last time to obtain new version information.
And thirdly, creating a corresponding relation between the new pixel value rule and the new version information.
And then, creating a corresponding relation between the new pixel value rule and the new version information, and storing the corresponding relation.
And fourthly, selecting a pixel value rule corresponding to the latest version information from the plurality of pixel value rules, and determining the pixel value rule as a target pixel value rule.
Because the probability that the acquired undetermined area in the video to be detected accords with the pixel value rule of the latest version information is high, the pixel value rule with the latest version information can be selected from the multiple pixel value rules to serve as the target pixel value rule.
As shown in fig. 4, in step S207 of the embodiment process shown in fig. 2b, after the step of determining whether each pixel value in the to-be-determined region meets the change rule of the pixel value between each pixel value in the pixel value adjustment region in the target pixel value rule according to the gradient feature of the to-be-determined region, the method for identifying a watermark video frame according to the embodiment of the present invention may further include:
s401, if each to-be-determined area does not accord with the change rule of the pixel values among the pixel values in the target pixel value rule and the pixel value adjustment area, selecting one pixel value rule from a plurality of pre-obtained pixel value rules, determining the pixel value rule as the target pixel value rule, returning to S207, and judging whether each pixel value in each to-be-determined area accords with the change rule of the pixel values among the pixel values in the target pixel value rule or not according to the gradient characteristics of each to-be-determined area.
If each to-be-detected region does not conform to the target pixel value rule, the change rule of the pixel value between each pixel value in the pixel value adjustment region indicates that each to-be-detected video frame in the to-be-detected video does not include the pixel value adjustment region conforming to the target pixel value rule, but the to-be-detected video frame in the to-be-detected video may include the pixel value adjustment region conforming to the other pixel value rules stored in the server, so that the pixel value rule corresponding to the adjacent version information can be selected from the plurality of pixel value rules, the target pixel value rule is determined, and whether each to-be-detected video frame in the to-be-detected video includes the pixel value adjustment region conforming to the re-determined target pixel value rule is determined again, that is, the process returns to step S207. And the adjacent version information is the adjacent version information of the current version information.
Further, when the server receives a request for obtaining a pixel value rule transmitted from the client, the stored plurality of pixel value rules and the version information corresponding to each of them may be transmitted to the client. Or the server may send the updated pixel value rule to the client after updating the pixel value rule.
S402, until the undetermined area in at least one video frame to be detected in the video to be detected accords with the target pixel value rule, the change rule of the pixel value among the pixel values in the pixel value adjusting area, or the undetermined areas in all the video frames to be detected do not accord with all the pixel value rules.
When the region to be detected in at least one video frame to be detected in the video to be detected conforms to the target pixel value rule, and the change rule of the pixel value among the pixel values in the pixel value adjusting region, whether the region to be detected in each video frame to be detected in the video to be detected conforms to other pixel value rules is not required to be detected. When the regions to be detected in all the video frames to be detected do not accord with all the pixel value rules, the pixel value adjusting regions are not contained in all the video frames to be detected, and the fact that the video to be detected does not contain the watermarks can be determined.
In the embodiment of the invention, the pixel value rule is updated at regular time, and the pixel value rule with the latest version information is used as the target pixel value rule, so that the identification difficulty of the watermark video frame can be further improved.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 5a, after the step S103 of the flow shown in fig. 1, of determining a video frame to be detected including a preset pixel value adjustment area as a video frame to which a watermark is added, the method for identifying a watermarked video frame according to the embodiment of the present invention further includes:
and S501, outputting and displaying the video frame added with the watermark. After the video frame added with the watermark is determined, the video frame added with the watermark can be output and displayed, so that research personnel can further identify the watermark for the video frame added with the watermark.
In addition, after the video frame added with the watermark is determined, besides the method of outputting and displaying the video frame to enable research and development personnel to identify the watermark in the video frame, the method of outputting the frame number of the video frame can also be adopted to enable the research and development personnel to search the video frame added with the watermark from the video to be detected according to the frame number and further identify the watermark from the video frame.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: adjusting the relative position relationship between the pixel value adjusting area and the watermark area; the relative positional relationship may include: the pixel value adjusts the difference in coordinates between the center of the area and the center of the watermarking area. The relative positional relationship between the pixel value adjustment area and the watermarking area may be established in advance.
As shown in fig. 5b, in step S103 of the embodiment flowchart shown in fig. 1, after the step of determining the video frame to be detected including the preset pixel value adjustment region as the video frame added with the watermark, the method for identifying a watermark video frame according to the embodiment of the present invention may further include:
s502, determining the watermark region based on the relative positional relationship between the pixel value adjustment region and the watermark region, and the pixel value adjustment region.
After detecting each video frame to be detected in the video to be detected and determining whether the video frame contains a preset pixel value adjustment area, if the video frame contains the pixel value adjustment area, the position of the pixel value adjustment area in the video frame can be determined. And then, the position of the area can be adjusted according to the relative position relation and the pixel value, the watermark area is determined from the video frame to be detected, the watermark is conveniently extracted from the video frame, the user information is determined according to the watermark, and the user who is illegally broadcast is positioned.
S503, the watermark region is highlighted.
Since the watermark region is determined, the watermark region can be highlighted. Referring to fig. 5c, the area in the frame is the watermark area, and "zhangsan" is the watermark, and when the watermark is identified, only the area in the frame may be identified, which may further improve the efficiency of identifying the watermark. The watermark shown in fig. 5c is an unencrypted watermark, and if the watermark is an encrypted watermark, the watermark image is relatively fuzzy, the watermark area is highlighted, and the effect of improving the efficiency is more obvious for subsequent manual identification of the watermark.
It should be noted that, in one video to be detected, there may be a video frame to be detected to which a watermark is added and which also includes a pixel value adjustment region, or there may be a plurality of video frames to be detected to which watermarks is added and which also includes a pixel value adjustment region. When the watermark is added at the client, the possibly added watermark is closer to the pixel value of the pixel in the original video frame, so that the watermark is difficult to identify, therefore, by adding the watermarks in a plurality of video frames to be detected and including the pixel value adjusting area, after the plurality of video frames including the watermark are determined, the plurality of video frames can be subjected to multiple comparisons and checks, so as to improve the accuracy of watermark extraction.
As shown in fig. 6, an embodiment of the present invention further provides a method for producing a watermarked video frame, where the method may include:
s601, obtaining an operation request of the video to be processed.
S602, selecting a video frame to be processed from the video to be processed.
S603, adding the target watermark into the video frame to be processed to obtain the video frame added with the watermark.
S604, for the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule, so that the pixel value adjustment area obtained after adjustment meets the target pixel value rule, where the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
The method for producing the watermark video frame, provided by the embodiment of the invention, is used for obtaining the operation request of the video to be processed; selecting a video frame to be processed from a video to be processed; adding the target watermark into the video frame to be processed to obtain the video frame added with the watermark; aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable a pixel value adjusting area obtained after adjustment to accord with the target pixel value rule, wherein the target pixel value rule comprises: the size of the pixel value adjusting area and the change rule of the pixel value size among the pixel values in the pixel value adjusting area. The method comprises the steps that the pixel value in a video frame added with the watermark is adjusted based on a target pixel value rule aiming at the video frame added with the watermark, so that an adjusted pixel value adjusting area obtained after adjustment accords with the target pixel value rule, the video frame added with the watermark also comprises the pixel value adjusting area, and in the process of identifying the watermark video frame, the video frame comprising the pixel value adjusting area can be identified from a video to be detected, and the video frame is the video frame comprising the target watermark.
Further, in step S601 in the embodiment flow shown in fig. 6, the operation request may include: a play request, an upload request, or a publish request. The video to be processed can be a video which a user wants to watch, upload or publish in the client, when the user clicks, uploads or publishes a certain video in a display page of the video APP, an operation request for the video is sent to the user client, the video is the video to be processed, and the client can obtain the operation request of the video to be processed.
Since the operated video is all likely to be a suspected illegally-played video in the playing, uploading and publishing processes of the user, after the playing request, the uploading request and the publishing request are obtained, the watermark can be added to the to-be-processed video frame to which the request is directed, so as to obtain the video frame to which the watermark is added. Therefore, by the method for identifying the watermark video frame, not only can a user recording and broadcasting or recording the screen video be traced, but also a user uploading and publishing the video can be traced.
Further, in step S602 in the embodiment of the flowchart shown in fig. 6, after the operation request of the video to be processed is obtained, the video frame to be processed may be selected from the video to be processed. In the specific implementation process, a video frame to be processed can be randomly selected from a video to be processed; the position of the selected video frame in the video may also be preset, for example, the position of the selected to-be-processed video frame in the to-be-processed video frame is preset, and the to-be-processed video frame is acquired from the to-be-processed video according to the preset position.
In the process of selecting the video frame to be processed from the video to be processed, one video frame to be processed can be selected, a plurality of video frames to be processed can also be selected, and the specific number can be preset.
Further, in the flow step S603 in the embodiment shown in fig. 6, since in the embodiment of the present invention, one of the purposes of adding a watermark in a video frame to be processed is: and (3) extracting the added watermark through detecting the suspected embezzled video to be detected, and determining the user who leaks the video based on the watermark. Therefore, the content included in the watermark may generally be capable of representing information of the user, for example, an account number used when the user logs in the video APP, or an Identity Document (ID) of the user, or an Identity of the user client. Specifically, after an operation request of a video to be processed is obtained, user information may be obtained, and a target watermark may be generated based on the user information, where the target watermark may be an image, and a pixel representing the user information and a background pixel respectively adopt different pixel values. The added watermark can be a common watermark or an encrypted watermark.
In the process of adding the target watermark to the video frame to be processed, the target watermark and the video frame to be processed can be subjected to fusion processing.
Further, in step S604 of the flow of the embodiment shown in fig. 6, the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted. The change rule of the pixel value between the pixel values in the pixel value adjusting region may include: the size relationship between the pixel values of two adjacent pixels, or the pixel values of the pixels from left to right in the same row gradually increase and gradually decrease, or the number of the pixel values increasing or decreasing, etc.
In addition, the target pixel value rule may further include a size of a pixel value adjustment region, where the size of the pixel value adjustment region may include: the length and width of the pixel value adjustment area, and the size of the pixel value adjustment area may be actually required to be set, for example, it may be set to be the same as the size of the video frame; for example, it may be set to a value of 300 × 300 or 400 × 400, etc.
For the video frame added with the watermark, a region to be adjusted can be randomly selected from the video frame added with the watermark according to the size of the pixel value adjusting region, and then the pixel value of the region to be adjusted in the video frame is adjusted based on a target pixel value rule, so that the pixel value adjusting region obtained after adjustment accords with the target pixel value rule. The setting of the pixel value adjusting area is not limited by the watermark area. In order to facilitate identification of the watermark, the pixel value adjustment region and the watermark region may not overlap completely, or may partially or completely overlap.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the pixel value adjusts the relative positional relationship between the area and the watermark area.
As shown in fig. 7, before the step S603 of adding the target watermark to the video frame to be processed and obtaining the video frame with the watermark in the embodiment shown in fig. 6, the method for producing a watermarked video frame according to the embodiment of the present invention may further include:
s701, determining a watermark area from the video frame to be processed.
The size of the watermark area can be predetermined, and then a watermark area with the size of the watermark area is randomly selected from the video frames to be processed, wherein the watermark area is used for adding the target watermark.
S702, determining the area to be adjusted from the video frame to be processed according to the watermark area, the relative position relation between the pixel value adjusting area and the watermark area and the size of the pixel value adjusting area in the target pixel value rule.
After the watermark region is determined, a region to be adjusted, which is a region for adjusting the pixel value, may be determined from the video frame to be processed according to the watermark region, the relative positional relationship between the pixel value adjustment region and the watermark region, and the size of the pixel value adjustment region in the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 8, before the step S603 of the embodiment flow shown in fig. 6, of adding a target watermark to a video frame to be processed and obtaining a watermarked video frame, the method for producing a watermarked video frame provided in the embodiment of the present invention may further include:
s801, determining a region to be adjusted from a video frame to be processed based on the size of the pixel value adjusting region in the target pixel value rule.
When the size of the pixel value adjustment region in the target pixel value rule only includes the length and the width of the pixel value adjustment region, one region to be adjusted can be randomly selected from the video frame to be processed according to the length and the width. Specifically, a pixel may be randomly selected from the video frame to be processed as a center point or a vertex of the region to be adjusted, and then the region to be adjusted may be determined according to the length and the width. Of course, if the area to be adjusted is selected by the method, it indicates that the random selection method is adopted each time the area to be adjusted is selected, so that the selected areas to be adjusted are different for different playing times. In the practical application process, the situation that a competitor or other persons who are not good will maliciously extract the watermark in the video frame often exists, and the difficulty in identifying the video frame containing the watermark can be increased by adopting a random selection method, so that the difficulty in extracting and tampering the watermark in the video frame is increased, and the recorded and broadcast video can be better prevented.
When the size of the pixel value adjustment region in the target pixel value rule includes the length, width and coordinate position of the vertex of the pixel value adjustment region, the vertex may be determined in the video frame to be processed first, and then the region to be adjusted may be determined according to the length and width.
S802, determining the watermark area according to the area to be adjusted and the relative position relation between the pixel value adjusting area and the watermark area.
After the relative position relationship is obtained, the watermark region can be determined from the video frame to be processed according to the relative position relationship and the region to be adjusted. For example, the relative positional relationship may include: the pixel value adjusts the difference in coordinates between the center of the area and the center of the watermarking area. After the watermark region is determined according to the relative position relationship, it is indicated that the watermark region and the pixel value adjustment region have the relative position relationship, so that after the server acquires the video frame to be detected, the pixel value adjustment region and the relative position relationship can be determined first, the watermark region in the pixel value adjustment region is determined, and the watermark can be further conveniently extracted from the pixel value adjustment region.
In addition, after the watermark area is determined, the target watermark can be added into the watermark area of the video frame to be processed, and the video frame with the added watermark is obtained. After the area to be adjusted is determined, the pixel value of the area to be adjusted in the video frame to which the watermark is added can be adjusted based on the target pixel value rule, so that the pixel value adjustment area obtained after adjustment conforms to the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: in the pixel value adjustment region, pixels having values increased compared to adjacent pixels account for a first proportion of the total pixels of the pixel value adjustment region, and pixels having values decreased compared to adjacent pixels account for a second proportion of the total pixels of the pixel value adjustment region.
In addition, since the first ratio is a ratio of pixels, which are increased in comparison with pixel values of adjacent pixels, to the total pixels in the pixel value adjustment area, when the first ratio is known, the second ratio can be obtained by subtracting the first ratio from 1. Therefore, only the first scale or the second scale may be included in the target pixel value rule.
In this case, as shown in fig. 9, in step S604 of the embodiment shown in fig. 6, for a video frame to which a watermark is added, the step of adjusting the pixel values in the video frame based on a target pixel value rule so that the pixel value adjustment area obtained after adjustment conforms to the target pixel value rule may include:
s901, generating a feature matrix according to the first proportion, the second proportion and the size of the pixel value adjusting area in the target pixel value rule.
In generating the feature matrix, the elements in the feature matrix may be predetermined, since each element in the feature matrix represents: in the pixel value adjustment region, the magnitude relationship between the pixel value of the pixel having the same position as the element and the pixel value of the adjacent pixel may be greater or smaller than that, and therefore, the element in the feature matrix may be set as two different flags, which are named as a seventh flag and an eighth flag, respectively, for convenience of description, and may be a numeric value, a letter, or a character. For example, the seventh flag indicates that the pixel value of the pixel is greater than the pixel value of the neighboring pixel and may be 1, and the eighth flag indicates that the pixel value of the pixel is less than the pixel value of the neighboring pixel and may be 0.
The process of generating the feature matrix may specifically be: determining the total number of elements in the characteristic matrix according to the size of a pixel value adjusting region in a target pixel value rule; then, a first number of pixels which are increased compared with the pixel values of the adjacent pixels and a second number of pixels which are decreased compared with the pixel values of the adjacent pixels can be determined according to the first proportion and the second proportion; and then, forming the first quantity of seventh marks and the second quantity of eighth marks into a feature matrix according to a preset forming rule. The preset composition rule may be an arrangement rule of each element in the feature matrix.
For example, it is assumed that the length and the width of the size information are both 300, the first ratio is 0.5, the seventh flag is 1, and the eighth flag is 0. The total number of elements in the feature matrix is 90000; the first number is 45000, the second number is 45000, when the predetermined composition rule is: the elements of each column are the same, and two adjacent elements in each row are different, so that the feature matrix is: the elements in the first row are 1, 0, 1 … …, respectively, the elements in the second row are 1, 0, 1 … …, respectively, and so on.
S902, traversing each pixel in the region to be adjusted, and judging whether the size relationship between the pixel value of the pixel and the pixel values of the adjacent pixels corresponds to the elements in the feature matrix.
And S903, if not, increasing or decreasing the pixel value of the pixel according to the feature matrix.
And S904, if yes, keeping the pixel value unchanged.
After the feature matrix is obtained, each pixel in the region to be adjusted may be traversed, and whether a size relationship between a pixel value of each pixel and a pixel value of an adjacent pixel corresponds to an element in the feature matrix may be determined. It should be noted here that, for the first column of pixels in the region to be adjusted, since there is no pixel before the column of pixels, the pixel value can be usually kept unchanged for the column of pixels. For each pixel in the second column, judging the size relationship between the pixel and the pixel value of the adjacent pixel to obtain a judgment result larger or smaller than the judgment result; determining elements with the same position in the feature matrix, determining the size relationship represented by the elements, judging whether the elements are consistent with each other, and if so, keeping the pixel value of the pixel unchanged; if not, the pixel value of the pixel needs to be increased or decreased according to the element so that the pixel value corresponds to the element.
For example, when the pixel value of the pixel in the first row and the second column in the region to be adjusted is larger than the pixel value of the pixel in the first row and the first column, and the element in the first row and the second column in the feature matrix is 0, it indicates an inconsistency, and the pixel value of the pixel in the first row and the second column in the region to be adjusted needs to be reduced to be smaller than the pixel value of the pixel in the first row and the first column.
In order to further improve the identification difficulty of the watermark video frame, the horizontal feature matrix and the vertical feature matrix can be respectively generated according to the first proportion, the second proportion and the size of the pixel value adjusting area in the target pixel value rule. Wherein the elements in the horizontal feature matrix represent: the magnitude relation between the pixel value of each pixel and the pixel values of the adjacent pixels in the same row; the elements in the vertical feature matrix represent: the magnitude relationship between the pixel value of each pixel and the pixel values of the adjacent pixels in the same column.
Then, each pixel in the region to be adjusted can be traversed, and whether the size relationship between the pixel value of each pixel and the pixel value of the adjacent pixel in the same row corresponds to an element in the horizontal feature matrix or not is judged; and if not, increasing or decreasing the pixel value of the pixel according to the horizontal feature matrix.
Judging whether the size relationship between the pixel value of the pixel and the pixel values of the adjacent pixels in the same column corresponds to an element in the vertical feature matrix or not; and if not, increasing or decreasing the pixel value of the pixel according to the vertical feature matrix.
In addition, in the embodiment of the present invention, the pixel value to be adjusted may be a luminance value, and before determining the pixel value of each pixel, the luminance value of each pixel may be acquired. Specifically, the following three ways can be adopted for acquisition:
the first method comprises the following steps: since a video frame to be processed may be an image represented by an RGB color space, the luminance value of each pixel may be calculated by extracting a color parameter value of a red channel, a color parameter value of a green channel, and a color parameter value of a blue channel of each pixel, and using a luminance value calculation formula.
And the second method comprises the following steps: an image represented by an RGB color space may be converted into a gray scale image, and then a luminance value may be extracted from the gray scale image.
Third, an image represented in RGB color space may be converted into a YUV image, from which luminance values are then obtained.
In the embodiment of the invention, a feature matrix can be generated according to the first proportion, the second proportion and the size of the pixel value adjusting area included in the target pixel value rule, each pixel in the area to be adjusted is traversed, and the size relation between the pixel value of each pixel and the pixel value of the adjacent pixel is judged whether to correspond to the element in the feature matrix; if not, the pixel value of the pixel is increased or decreased according to the feature matrix, so that the pixel value in the video frame to be processed can be adjusted based on the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the arrangement order of the pixels in the pixel value adjustment region in which the pixel value increases compared to the adjacent pixel value and the pixels in which the pixel value decreases compared to the adjacent pixel value.
In step S901 of the embodiment shown in fig. 9, the step of generating a feature matrix according to the first ratio, the second ratio, and the size of the pixel value adjustment area in the target pixel value rule includes:
and generating a feature matrix according to the first proportion, the second proportion, the arrangement sequence in the target pixel value rule and the size of the pixel value adjusting area in the target pixel value rule.
When the first proportion of pixels having increased values compared to the adjacent pixels in the pixel value adjustment region to the total pixels of the pixel value adjustment region and the second proportion of pixels having decreased values compared to the adjacent pixels to the total pixels of the pixel value adjustment region are determined, there may also be a plurality of different arrangement orders of the pixels having increased values compared to the adjacent pixels and the pixels having decreased values compared to the adjacent pixels, and therefore, in generating the feature matrix, the arrangement order of the pixels having increased values compared to the adjacent pixels in the target pixel value rule and the pixels having decreased values compared to the adjacent pixels may also be considered to generate only one feature matrix.
As an optional implementation manner in the embodiment of the present invention, as shown in fig. 10, before the step S604 in the embodiment of the present invention, in which a pixel value in a video frame to which a watermark is added is adjusted based on a target pixel value rule, so that a pixel value adjustment area obtained after the adjustment conforms to the target pixel value rule, the method for producing a watermarked video frame according to the embodiment of the present invention may further include:
s1001, a plurality of pixel value rules and version information corresponding to each pixel value rule are obtained.
In order to prevent the pixel value rules from being maliciously cracked, so that the video frame to be processed with the target watermark is identified, the server may update the pixel value rules at intervals, or update the pixel value rules after the pixel value rules are cracked. Thus, a plurality of pixel value rules are stored in the server. The client can acquire a plurality of pixel value rules and version information corresponding to each pixel value rule from the server. The version information may be a numerical value and may indicate a sequence in which the server stores the rule of each pixel value.
S1002, selecting the pixel value rule with the latest version information from the plurality of pixel value rules, and determining the pixel value rule as a target pixel value rule.
Because the probability that the pixel value rule corresponding to the information except the latest version is cracked is higher, the pixel value rule with the latest version information can be selected from the plurality of pixel value rules according to the version information to be used as the target pixel value rule.
In the embodiment of the invention, the identification difficulty of the encrypted watermark video frame can be further improved by acquiring a plurality of pixel value rules from the server and taking the pixel value rule with the latest version information as the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, an encrypted watermark may be added to a video frame to be processed, as shown in fig. 11, and step S603 of the embodiment shown in fig. 6 is a step of adding a target watermark to the video frame to be processed to obtain a video frame with a watermark added thereto, where the step may include:
s1101, obtaining area pixel values of all pixels in the watermark area; and acquiring watermark pixel values of all pixels in the target watermark.
After determining the watermark region, a region pixel value of each pixel in the watermark region may be obtained, and the region pixel value may include: a color parameter value for a red channel, a color parameter value for a green channel, and a color parameter value for a blue channel.
The watermark pixel value of each pixel may be obtained from the target watermark, and the watermark pixel value may also include: a color parameter value for a red channel, a color parameter value for a green channel, and a color parameter value for a blue channel.
S1102, calculating a first product between the area pixel value and a first preset weight coefficient; and calculating a second product between the watermark pixel value and a second preset weight coefficient.
The first preset weight coefficient and the second preset weight coefficient can be preset according to experience or experiments, the sum of the two weight coefficients can be 1, and the setting of the weight coefficients can be in a principle that the watching experience of a user is not influenced and the video frame to be processed is not easy to find when the video frame is inspected by naked eyes. For example, the first preset weight coefficient may be set to 0.7, and the second preset weight coefficient may be set to 0.3.
When a first product between the regional pixel value and a first preset weight coefficient is calculated, color parameter values of three channels need to be multiplied by the first preset weight coefficient respectively; similarly, when calculating the second product between the watermark pixel value and the second preset weight coefficient, it is necessary to multiply the color parameter values of the three channels by the second preset weight coefficient, respectively.
S1103, a sum of the first product and the second product is calculated as a target pixel value.
The sum of the first product and the second product may be taken as the target pixel value. Here, since the size of the watermark region may be the same as the size of the target watermark, the calculation of the target pixel value is performed using the pixel values of the pixels at the same positions as the watermark region and the target watermark.
For example: the pixel values of the pixels in the first row and the first column in the watermark region are: r1, g1, and b1, the pixel values of the pixels in the first column of the first row in the target watermark are: r2, g2 and b2, the first predetermined weight coefficient is a1, the second predetermined weight coefficient is a2, the target pixel values r3, g3 and b3 in the first row and the first column are: r3 ═ r1 a1+ r 2a 2; g3 ═ g1 a1+ g 2a 2; b3 ═ b1 a1+ b 2a 2.
S1104, the pixel value of the pixel in the watermark region is updated to the target pixel value.
After the target pixel value of the pixel in each watermark region is obtained, the pixel value of each pixel may be updated to the target pixel value. In the embodiment of the invention, the pixel values of the pixels in the watermark area and the pixel values of the pixels in the target watermark are weighted, so that the target watermark is not easy to find in the video frame to be processed added with the target watermark.
An embodiment of the present invention provides a specific embodiment of an apparatus for identifying a watermark video frame, which corresponds to the flow shown in fig. 1, and referring to fig. 12, fig. 12 is a schematic structural diagram of an apparatus for identifying a watermark video frame according to an embodiment of the present invention, where the apparatus for identifying a watermark video frame may include:
a to-be-detected video obtaining module 1201, configured to obtain a to-be-detected video.
A to-be-detected video frame detection module 1202, configured to detect each to-be-detected video frame in a to-be-detected video, and determine whether the video frame includes a preset pixel value adjustment region; the pixel value adjustment area is: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
The video frame determining module 1203 is configured to determine a video frame to be detected, which includes a preset pixel value adjustment area, as a video frame to which the watermark is added.
The identification device of the watermark video frame provided by the embodiment of the invention acquires the video to be detected; and detecting each video frame to be detected in the video to be detected, and determining whether the video frame contains a preset pixel value adjusting area, wherein the pixel value adjusting area is an area which accords with the target pixel value rule after adjusting the pixel value in the video frame added with the watermark in advance. Therefore, when the video frame including the pixel value adjustment region is identified from the video to be detected, the video frame is the video frame added with the watermark, that is, the video frame to be detected including the preset pixel value adjustment region can be determined as the video frame added with the watermark. Therefore, the embodiment of the invention can automatically identify the video frame containing the watermark from the video to be detected.
As an optional implementation manner of the embodiment of the present invention, the pixel value adjustment area specifically includes: and aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule, and then conforming to the region of the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, the module 1202 for detecting a video frame to be detected may include:
the first gradient feature extraction submodule is used for extracting the gradient feature of each video frame to be detected; each element in the gradient signature represents: and the size relation between the pixel value of the pixel with the same position as the element in the video frame to be detected and the pixel value of the adjacent pixel.
And the first pixel value judgment submodule is used for judging whether each pixel value in the video frame to be detected accords with the change rule of the pixel value among the pixel values in the pixel value adjustment area in the target pixel value rule or not according to the gradient characteristic of the video frame to be detected.
And the first video frame determining submodule is used for determining whether the video frame to be detected contains a preset pixel value adjusting area if the video frame to be detected contains the preset pixel value adjusting area.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the pixel values adjust the size of the region.
The device for identifying the watermark video frame of the embodiment of the invention also comprises:
and the undetermined region obtaining module is used for traversing each video frame to be detected based on the size of the pixel value adjusting region included in the target pixel value rule to obtain a plurality of undetermined regions of which the region size is the size of the pixel value adjusting region in the video frame to be detected.
The module 1202 for detecting video frames to be detected includes:
the second gradient feature extraction submodule is used for extracting the gradient feature of the undetermined area aiming at each undetermined area; the elements in the gradient characteristic of the region to be localized represent: and the size relation between the pixel value of the pixel with the same position as the element in the region to be determined and the pixel value of the adjacent pixel.
And the second pixel value judgment submodule is used for judging whether each pixel value in the region to be determined meets the change rule of the pixel value among the pixel values in the pixel value adjustment region in the target pixel value rule or not according to the gradient characteristic of the region to be determined.
And the second video frame determining submodule is used for determining that the video frame where the undetermined area is located contains a preset pixel value adjusting area if the undetermined area accords with the change rule of the pixel value among all the pixel values in the pixel value adjusting area in the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, in the target pixel value rule, a rule of change in pixel value between pixel values in the pixel value adjustment region includes: a first proportion of pixels with increased values compared to adjacent pixels to total pixels of the pixel value adjustment region, and a second proportion of pixels with decreased values compared to adjacent pixels to total pixels of the pixel value adjustment region.
The gradient characteristic of each pending area comprises: the pixel value of each pixel is increased or decreased by the corresponding flag compared to the adjacent pixel values.
The second pixel value determination sub-module includes:
and the proportion counting unit is used for counting a third proportion of pixels with increased pixel values compared with adjacent pixel values in the gradient feature in the total pixels in the pixel value adjusting area and a fourth proportion of pixels with decreased pixel values compared with adjacent pixel values in the total pixels in the pixel value adjusting area based on the identification that the pixel values of the pixels are increased or decreased compared with the adjacent pixel values in the gradient feature.
And the first proportion judging unit is used for judging whether the absolute value of the difference between the counted third proportion and the first proportion is smaller than or equal to a first preset threshold value, if so, the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule.
Or the second proportion judging unit is used for judging whether the absolute value of the difference value between the counted fourth proportion and the second proportion is smaller than or equal to a second preset threshold value, if so, the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the arrangement order of the pixels in the pixel value adjustment region in which the pixel value increases compared to the adjacent pixel value and the pixels in which the pixel value decreases compared to the adjacent pixel value.
The first proportion judgment unit is specifically configured to: and judging whether the absolute value of the difference between the third proportion and the first proportion is less than or equal to a first preset threshold, if so, judging whether the arrangement sequence of the marks for increasing or decreasing the pixel values of each pixel compared with the adjacent pixel values accords with the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area accords with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule.
The second proportion judging unit is specifically configured to: and judging whether the absolute value of the difference between the fourth proportion and the second proportion is less than or equal to a first preset threshold, if so, judging whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of all the pixels accords with the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area accords with the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, for any pixel, an adjacent pixel of the pixel and the pixel are located in the same horizontal direction or the same vertical direction.
As an optional implementation manner of the embodiment of the present invention, the apparatus for identifying a watermark video frame provided in the embodiment of the present invention further includes:
and the pixel value rule selecting module is used for selecting a pixel value rule from a plurality of pixel value rules obtained in advance to determine the pixel value rule as the target pixel value rule if each undetermined area does not accord with the change rule of the pixel values among the pixel values in the target pixel value rule and the pixel value adjustment area, and returning to the step of judging whether each pixel value in each undetermined area accords with the change rule of the pixel values among the pixel values in the target pixel value rule or not according to the gradient characteristic of each undetermined area.
As an optional implementation manner of the embodiment of the present invention, the apparatus for identifying a watermark video frame provided in the embodiment of the present invention further includes:
and the video frame output module is used for outputting and displaying the video frame added with the watermark.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the pixel value adjusts the relative positional relationship between the area and the watermark area.
The device for identifying a watermark video frame provided by the embodiment of the invention further comprises:
and the watermark region determining module is used for determining the watermark region based on the relative position relationship between the pixel value adjusting region and the watermark region and the pixel value adjusting region.
And the watermark area display module is used for highlighting the watermark area.
An embodiment of the present invention provides a specific embodiment of a device for producing a watermark video frame, which corresponds to the flow shown in fig. 6, and referring to fig. 13, fig. 13 is a schematic structural diagram of the device for producing a watermark video frame according to the embodiment of the present invention, where the device for producing a watermark video frame may include:
an operation request obtaining module 1301, configured to obtain an operation request of a video to be processed.
A to-be-processed video frame selecting module 1302, configured to select a to-be-processed video frame from a to-be-processed video.
And the target watermark adding module 1303 is configured to add the target watermark to the video frame to be processed to obtain the video frame with the added watermark.
A pixel value adjusting module 1304, configured to, for the video frame to which the watermark is added, adjust a pixel value in the video frame based on a target pixel value rule, so that a pixel value adjustment area obtained after adjustment meets the target pixel value rule, where the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
The production device of the watermark video frame provided by the embodiment of the invention obtains the operation request of the video to be processed; selecting a video frame to be processed from a video to be processed; adding the target watermark into the video frame to be processed to obtain the video frame added with the watermark; aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable a pixel value adjusting area obtained after adjustment to accord with the target pixel value rule, wherein the target pixel value rule comprises: the size of the pixel value adjusting area and the change rule of the pixel value size among the pixel values in the pixel value adjusting area. The method comprises the steps that the pixel value in a video frame added with the watermark is adjusted based on a target pixel value rule aiming at the video frame added with the watermark, so that an adjusted pixel value adjusting area obtained after adjustment accords with the target pixel value rule, the video frame added with the watermark also comprises the pixel value adjusting area, and in the process of identifying the watermark video frame, the video frame comprising the pixel value adjusting area can be identified from a video to be detected, and the video frame is the video frame comprising the target watermark.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the pixel value adjusts the relative positional relationship between the area and the watermark area.
The apparatus for producing a watermark video frame provided in the embodiment of the present invention may further include:
the first watermark region determining module is used for determining a watermark region from the video frame to be processed, and the watermark region is a region for adding a target watermark.
And the first area to be adjusted determining module is used for determining an area to be adjusted from the video frame to be processed according to the watermark area, the relative position relation between the pixel value adjusting area and the watermark area and the size of the pixel value adjusting area in the target pixel value rule, wherein the area to be adjusted is used for adjusting the pixel value.
Alternatively, the first and second electrodes may be,
and the second area to be adjusted determining module is used for determining the area to be adjusted from the video frame to be processed based on the size of the pixel value adjusting area in the target pixel value rule.
And the second watermark region determining module is used for determining the watermark region according to the region to be adjusted and the relative position relationship between the pixel value adjusting region and the watermark region.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: in the pixel value adjustment region, pixels having values increased compared to adjacent pixels account for a first proportion of the total pixels of the pixel value adjustment region, and pixels having values decreased compared to adjacent pixels account for a second proportion of the total pixels of the pixel value adjustment region.
The pixel value adjusting module 1304 may include:
the characteristic matrix generation submodule is used for generating a characteristic matrix according to the first proportion, the second proportion and the size of a pixel value adjustment area in the target pixel value rule; each element in the feature matrix represents: in the pixel value adjustment region, the magnitude relationship between the pixel value of the pixel having the same position as the element and the pixel value of the adjacent pixel.
The pixel value size relation judging submodule is used for traversing each pixel in the area to be adjusted and judging whether the size relation between the pixel value of the pixel and the pixel value of the adjacent pixel corresponds to an element in the characteristic matrix or not; and if not, increasing or decreasing the pixel value of the pixel according to the feature matrix.
As an optional implementation manner of the embodiment of the present invention, the target pixel value rule further includes: the arrangement order of the pixels in the pixel value adjustment region in which the pixel value increases compared to the adjacent pixel value and the pixels in which the pixel value decreases compared to the adjacent pixel value.
The feature matrix generation submodule is specifically configured to:
and generating a feature matrix according to the first proportion, the second proportion, the arrangement sequence in the target pixel value rule and the size of the pixel value adjusting area in the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, the apparatus for producing a watermark video frame provided in the embodiment of the present invention may further include:
and the second pixel value rule obtaining module is used for obtaining a plurality of pixel value rules and version information corresponding to each pixel value rule.
And the second pixel value rule selecting module is used for selecting the pixel value rule with the latest version information from the plurality of pixel value rules and determining the pixel value rule as the target pixel value rule.
As an optional implementation manner of the embodiment of the present invention, the target watermark adding module 1303 may include:
the pixel value acquisition submodule is used for acquiring the regional pixel value of each pixel in the watermark region; and acquiring watermark pixel values of all pixels in the target watermark.
The product calculation submodule is used for calculating a first product between the area pixel value and a first preset weight coefficient; and calculating a second product between the watermark pixel value and a second preset weight coefficient.
And the product sum calculation submodule is used for calculating the sum of the first product and the second product as the target pixel value.
And the pixel value updating sub-module is used for updating the pixel value of the pixel in the watermark area to the target pixel value.
As an optional implementation manner of the embodiment of the present invention, the operation request includes: a play request, an upload request, or a publish request.
The embodiment of the present invention further provides an electronic device, as shown in fig. 14, which includes a processor 1401, a communication interface 1402, a memory 1403, and a communication bus 1404, where the processor 1401, the communication interface 1402, and the memory 1403 complete communication with each other through the communication bus 1404.
A memory 1403 for storing a computer program.
The processor 1401, when executing the program stored in the memory 1403, implements the following steps:
and acquiring the video to be detected.
Detecting each video frame to be detected in a video to be detected, and determining whether the video frame contains a preset pixel value adjusting area; the pixel value adjustment area is: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
And determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark.
The embodiment of the present invention further provides an electronic device, as shown in fig. 15, including a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504, where the processor 1501, the communication interface 1502, and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program.
The processor 1501, when executing the program stored in the memory 1503, implements the following steps:
obtaining an operation request of a video to be processed, wherein the operation request comprises: a play request, an upload request, or a publish request.
And selecting a video frame to be processed from the video to be processed.
And adding the target watermark into the video frame to be processed to obtain the video frame added with the watermark.
Aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable a pixel value adjusting area obtained after adjustment to accord with the target pixel value rule, wherein the target pixel value rule comprises: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In yet another embodiment provided by the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method for identifying a watermarked video frame according to any one of fig. 1 to 5.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method for producing a watermarked video frame according to any one of fig. 6 to 11.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for identifying a watermarked video frame according to any one of fig. 1 to 5 in the above-mentioned embodiments.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for producing a watermarked video frame according to any one of fig. 6 to 11 in the above-mentioned embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (23)

1. A method for identifying a watermarked video frame, the method comprising:
acquiring a video to be detected;
detecting each video frame to be detected in the video to be detected, and determining whether the video frame contains a preset pixel value adjusting area; the pixel value adjustment area is as follows: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule comprises: the change rule of the pixel value among all the pixel values in the pixel value adjusting area is adjusted;
and determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark.
2. The method according to claim 1, wherein the pixel value adjustment region is specifically: and aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule, and then conforming to the region of the target pixel value rule.
3. The method according to claim 1, wherein the step of detecting each video frame to be detected in the video to be detected and determining whether the video frame includes a preset pixel value adjustment region includes:
extracting gradient characteristics of each video frame to be detected;
each element in the gradient signature represents: the size relation between the pixel value of the pixel with the same position as the element in the video frame to be detected and the pixel value of the adjacent pixel;
judging whether each pixel value in the video frame to be detected accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient characteristics of the video frame to be detected;
and if so, the video frame to be detected comprises a preset pixel value adjusting area.
4. The method of claim 1, wherein the target pixel value rule further comprises: adjusting the size of the area by the pixel value;
the step of detecting each video frame to be detected in the video to be detected and determining whether the video frame contains a preset pixel value adjustment area includes:
traversing each video frame to be detected based on the size of a pixel value adjusting area included in the target pixel value rule to obtain a plurality of regions to be determined, wherein the region size of each region to be determined is the size of the pixel value adjusting area in the video frame to be detected;
extracting gradient features of the regions to be determined aiming at each region to be determined; each element in the gradient feature of the region to be localized represents: the size relationship between the pixel value of the pixel with the same position as the element in the undetermined area and the pixel value of the adjacent pixel;
judging whether each pixel value in the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient feature of the undetermined area;
and if the undetermined area accords with the change rule of the pixel value among all the pixel values in the pixel value adjusting area in the target pixel value rule, the video frame where the undetermined area is located comprises a preset pixel value adjusting area.
5. The method according to claim 4, wherein the target pixel value rule includes a rule of change in pixel value size between pixel values in the pixel value adjustment region, including: a first proportion of pixels with increased values compared to adjacent pixel values to total pixels of the pixel value adjustment region and a second proportion of pixels with decreased values compared to adjacent pixel values to total pixels of the pixel value adjustment region;
the gradient characteristic of the region to be determined comprises: the pixel value of each pixel is increased or decreased by the corresponding mark compared with the adjacent pixel value;
the step of judging whether each pixel value in the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient feature of the undetermined area comprises the following steps:
counting a third proportion of pixels which are increased compared with the adjacent pixel values in the pixel value adjustment area and a fourth proportion of pixels which are decreased compared with the adjacent pixel values in the pixel value adjustment area based on the identification that the pixel values of all the pixels are increased or decreased compared with the adjacent pixel values in the gradient feature;
judging whether the absolute value of the difference between the third ratio and the first ratio is smaller than or equal to a first preset threshold value, if so, determining that the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule;
or judging whether the absolute value of the difference between the counted fourth proportion and the second proportion is smaller than or equal to a second preset threshold, if so, the undetermined area conforms to the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule.
6. The method according to claim 5, wherein the target pixel value rule further comprises: the arrangement order of the pixels in the pixel value adjustment region, in which the pixel value is increased compared with the adjacent pixel value, and the pixels in the pixel value adjustment region, in which the pixel value is decreased compared with the adjacent pixel value;
the step of judging whether the absolute value of the difference between the third ratio and the first ratio is smaller than or equal to a first preset threshold value, if so, the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule, and the step includes:
judging whether the absolute value of the difference between the third proportion and the first proportion is smaller than or equal to the first preset threshold, if so, judging whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of all the pixels conforms to the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule;
the step of judging whether the absolute value of the difference between the counted fourth proportion and the second proportion is smaller than or equal to a second preset threshold value, if so, the undetermined area accords with the change rule of the pixel value among the pixel values in the pixel value adjusting area in the target pixel value rule, and the step includes the following steps:
and judging whether the absolute value of the difference between the fourth proportion and the second proportion is less than or equal to the first preset threshold, if so, judging whether the arrangement sequence of the marks, which are increased or decreased compared with the adjacent pixel values, of the pixel values of all the pixels conforms to the arrangement sequence in the target pixel value rule, and if so, judging that the undetermined area conforms to the change rule of the pixel values among all the pixel values in the pixel value adjusting area in the target pixel value rule.
7. The method according to any one of claims 1-6, wherein for any pixel, the neighboring pixels of the pixel are located in the same horizontal direction or the same vertical direction as the pixel.
8. The method according to claim 4, wherein after the step of determining whether each pixel value in the to-be-determined region meets the target pixel value rule according to the gradient feature of the to-be-determined region, the method further comprises:
and if each undetermined area does not accord with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule, selecting one pixel value rule from a plurality of pixel value rules acquired in advance, determining the pixel value rule as the target pixel value rule, and returning to the step of judging whether each pixel value in each undetermined area accords with the change rule of the pixel values among the pixel values in the pixel value adjusting area in the target pixel value rule or not according to the gradient characteristic of each undetermined area.
9. The method according to claim 1, wherein after the step of determining the video frame to be detected containing the preset pixel value adjustment region as the video frame to which the watermark is added, the method further comprises:
and outputting and displaying the video frame added with the watermark.
10. The method of claim 9, wherein the target pixel value rule further comprises: adjusting the relative position relationship between the pixel value adjusting area and the watermark area;
after the step of determining the video frame to be detected containing the preset pixel value adjustment area as the video frame added with the watermark, the method further comprises:
determining the watermark region based on the relative position relationship between the pixel value adjustment region and the watermark region and the pixel value adjustment region;
and highlighting the watermark area.
11. A method of producing watermarked video frames, the method comprising:
acquiring an operation request of a video to be processed;
selecting a video frame to be processed from the video to be processed;
adding a target watermark into the video frame to be processed to obtain a video frame added with the watermark;
aiming at the video frame added with the watermark, adjusting the pixel value in the video frame based on a target pixel value rule so as to enable a pixel value adjusting area obtained after adjustment to accord with the target pixel value rule, wherein the target pixel value rule comprises: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
12. The method of claim 11, wherein the target pixel value rule further comprises: adjusting the relative position relationship between the pixel value adjusting area and the watermark area;
before the step of adding the target watermark to the video frame to be processed to obtain the watermarked video frame, the method further includes:
determining a watermark region from the video frame to be processed, wherein the watermark region is a region for adding a target watermark;
determining a region to be adjusted from the video frame to be processed according to the watermark region, the relative position relationship between the pixel value adjusting region and the watermark region and the size of the pixel value adjusting region in the target pixel value rule, wherein the region to be adjusted is a region for adjusting the pixel value;
alternatively, the first and second electrodes may be,
determining a region to be adjusted from a video frame to be processed based on the size of the pixel value adjustment region in the target pixel value rule;
and determining the watermark region according to the region to be adjusted and the relative position relationship between the pixel value adjustment region and the watermark region.
13. The method of claim 12, wherein the target pixel value rule further comprises: in the pixel value adjusting area, pixels with values increased compared with adjacent pixels account for a first proportion of total pixels of the pixel value adjusting area, and pixels with values decreased compared with adjacent pixels account for a second proportion of total pixels of the pixel value adjusting area;
the step of adjusting the pixel value in the video frame based on the target pixel value rule aiming at the video frame added with the watermark so as to make the pixel value adjustment area obtained after adjustment accord with the target pixel value rule comprises the following steps:
generating a feature matrix according to the first proportion, the second proportion and the size of a pixel value adjusting region in the target pixel value rule; each element in the feature matrix represents: in the pixel value adjustment region, the magnitude relation between the pixel value of the pixel having the same position as the element and the pixel value of the adjacent pixel;
traversing each pixel in the area to be adjusted, and judging whether the size relationship between the pixel value of the pixel and the pixel value of the adjacent pixel corresponds to an element in the characteristic matrix; and if not, increasing or decreasing the pixel value of the pixel according to the feature matrix.
14. The method of claim 13, wherein the target pixel value rule further comprises: the arrangement order of the pixels in the pixel value adjustment region, in which the pixel value is increased compared with the adjacent pixel value, and the pixels in the pixel value adjustment region, in which the pixel value is decreased compared with the adjacent pixel value;
the step of generating a feature matrix according to the first proportion, the second proportion and the size of the pixel value adjustment region in the target pixel value rule includes:
and generating a feature matrix according to the first proportion, the second proportion, the arrangement sequence in the target pixel value rule and the size of a pixel value adjusting area in the target pixel value rule.
15. The method according to claim 11, wherein before the step of adjusting the pixel values in the video frame based on the target pixel value rule for the watermarked video frame so that the pixel value adjustment area obtained after the adjustment conforms to the target pixel value rule, the method further comprises:
acquiring a plurality of pixel value rules and version information corresponding to each pixel value rule;
and selecting the pixel value rule with the latest version information from the plurality of pixel value rules, and determining the pixel value rule as the target pixel value rule.
16. The method according to claim 11, wherein the step of adding the target watermark to the video frame to be processed to obtain the watermarked video frame comprises:
acquiring the area pixel value of each pixel in the watermark area; acquiring watermark pixel values of all pixels in the target watermark;
calculating a first product between the region pixel value and a first preset weight coefficient; and calculating a second product between the watermark pixel value and a second preset weight coefficient;
calculating the sum of the first product and the second product as a target pixel value;
updating the pixel values of the pixels in the watermark region to the target pixel values.
17. The method of claim 11, wherein the operation request comprises: a play request, an upload request, or a publish request.
18. An apparatus for identifying a watermarked video frame, the apparatus comprising:
the to-be-detected video acquisition module is used for acquiring a to-be-detected video;
the video frame detection module to be detected is used for detecting each video frame to be detected in the video to be detected and determining whether the video frame contains a preset pixel value adjustment area; the pixel value adjustment area is as follows: adjusting pixel values in the video frame based on a target pixel value rule, and then conforming to the target pixel value rule; the target pixel value rule comprises: the change rule of the pixel value among all the pixel values in the pixel value adjusting area is adjusted;
and the video frame determining module is used for determining the video frame to be detected containing the preset pixel value adjusting area as the video frame added with the watermark.
19. An apparatus for producing watermarked video frames, the apparatus comprising:
the operation request acquisition module is used for acquiring an operation request of a video to be processed;
the video frame selection module to be processed is used for selecting video frames to be processed from the videos to be processed;
the target watermark adding module is used for adding a target watermark into the video frame to be processed to obtain a video frame added with the watermark;
a pixel value adjusting module, configured to adjust, for the video frame with the watermark added, a pixel value in the video frame based on a target pixel value rule, so that a pixel value adjustment area obtained after adjustment meets the target pixel value rule, where the target pixel value rule includes: and the change rule of the pixel value among the pixel values in the pixel value adjusting area is adjusted.
20. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-10 when executing a program stored in the memory.
21. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 11 to 17 when executing a program stored in the memory.
22. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-10.
23. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any of the claims 11-17.
CN202110275124.0A 2021-03-15 2021-03-15 Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment Active CN113015004B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110275124.0A CN113015004B (en) 2021-03-15 2021-03-15 Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110275124.0A CN113015004B (en) 2021-03-15 2021-03-15 Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment

Publications (2)

Publication Number Publication Date
CN113015004A true CN113015004A (en) 2021-06-22
CN113015004B CN113015004B (en) 2023-04-28

Family

ID=76406986

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110275124.0A Active CN113015004B (en) 2021-03-15 2021-03-15 Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113015004B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117314774A (en) * 2023-09-26 2023-12-29 广州市星飞达电子科技有限公司 Infrared image correction system based on detector temperature

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002354219A (en) * 2001-05-23 2002-12-06 Sony Corp Method and device for embedding electronic watermark and program
JP2012151535A (en) * 2011-01-17 2012-08-09 Nippon Hoso Kyokai <Nhk> Digital watermark embedding device, digital watermark embedding program, digital watermark detector and digital watermark detection program
US20180167630A1 (en) * 2015-05-01 2018-06-14 Verance Corporation Watermark recovery using audio and video watermarking
US20190124345A1 (en) * 2017-10-18 2019-04-25 The Quantum Group Inc. Cloaking and watermark of non-coded information
CN110084735A (en) * 2019-04-26 2019-08-02 新华三云计算技术有限公司 Watermark adding method, analytic method, device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002354219A (en) * 2001-05-23 2002-12-06 Sony Corp Method and device for embedding electronic watermark and program
JP2012151535A (en) * 2011-01-17 2012-08-09 Nippon Hoso Kyokai <Nhk> Digital watermark embedding device, digital watermark embedding program, digital watermark detector and digital watermark detection program
US20180167630A1 (en) * 2015-05-01 2018-06-14 Verance Corporation Watermark recovery using audio and video watermarking
US20190124345A1 (en) * 2017-10-18 2019-04-25 The Quantum Group Inc. Cloaking and watermark of non-coded information
CN110084735A (en) * 2019-04-26 2019-08-02 新华三云计算技术有限公司 Watermark adding method, analytic method, device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117314774A (en) * 2023-09-26 2023-12-29 广州市星飞达电子科技有限公司 Infrared image correction system based on detector temperature
CN117314774B (en) * 2023-09-26 2024-04-09 广州市星飞达电子科技有限公司 Infrared image correction system based on detector temperature

Also Published As

Publication number Publication date
CN113015004B (en) 2023-04-28

Similar Documents

Publication Publication Date Title
US11470383B2 (en) Dynamic video overlays
KR102562208B1 (en) Video data processing method and related device
US20160366463A1 (en) Information pushing method, terminal and server
AU2020217352A1 (en) Detecting segments of a video program
CN108769776B (en) Title subtitle detection method and device and electronic equipment
JP5325267B2 (en) Object display device, object display method, and object display program
CN106412720B (en) Method and device for removing video watermark
CN107590447A (en) A kind of caption recognition methods and device
KR101620748B1 (en) Item recommendation method and apparatus
JP6127226B1 (en) Image processing apparatus, image processing method, and program
WO2017211250A1 (en) Image overlay display method and system
WO2019000793A1 (en) Pixelating method and device for live broadcasting, electronic device, and storage medium
US20130088645A1 (en) Method of Processing Moving Picture and Apparatus Thereof
CN113015004B (en) Watermark video frame identification method, watermark video frame production method, watermark video frame identification device and electronic equipment
CN113393471A (en) Image processing method and device
CN115314734A (en) Video watermark processing method and device, electronic equipment and storage medium
CN110120039B (en) Screen detection method, screen detection device, electronic equipment and readable storage medium
CN109408652B (en) Picture searching method, device and equipment
EP3410686B1 (en) Image processing device, image processing method, and program
Hu et al. Fast source camera identification using matching signs between query and reference fingerprints
CN111640150A (en) Video data source analysis system and method
CN113076961A (en) Image feature library updating method, image detection method and device
CN113962838A (en) Watermark image embedding/enhancing method, device and computer system
US10965936B2 (en) Apparatus, method and system for detecting additional data for preventing forgery of video content, rendering apparatus interoperating with display apparatus, and rendering method thereof
CN115983499A (en) Box office prediction method and device, electronic equipment and storage medium

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