CN117156154A - Dual video watermark embedding method, dual video watermark extracting device and electronic equipment - Google Patents

Dual video watermark embedding method, dual video watermark extracting device and electronic equipment Download PDF

Info

Publication number
CN117156154A
CN117156154A CN202311110524.1A CN202311110524A CN117156154A CN 117156154 A CN117156154 A CN 117156154A CN 202311110524 A CN202311110524 A CN 202311110524A CN 117156154 A CN117156154 A CN 117156154A
Authority
CN
China
Prior art keywords
target
watermark
frame
value
video
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.)
Pending
Application number
CN202311110524.1A
Other languages
Chinese (zh)
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 Zhongke Bentong Cultural Technology Co ltd
Original Assignee
Beijing Zhongke Bentong Cultural 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 Zhongke Bentong Cultural Technology Co ltd filed Critical Beijing Zhongke Bentong Cultural Technology Co ltd
Priority to CN202311110524.1A priority Critical patent/CN117156154A/en
Publication of CN117156154A publication Critical patent/CN117156154A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • H04N19/467Embedding additional information in the video signal during the compression process characterised by the embedded information being invisible, e.g. watermarking

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention provides a dual video watermark embedding method, a dual video watermark extracting device and electronic equipment, and relates to the technical field of video information processing, wherein the dual video watermark embedding method comprises the following steps: constructing a first re-watermark and a second re-watermark according to the copyright resource identification; extracting at least one group of video frame sequences from an original video, wherein the video frame sequences comprise an original scene switching frame and an original scene unchanged frame; embedding the first re-watermark into the original scene switching frame based on the first quantization step length to obtain a target scene switching frame; embedding a second watermark into the original scene unchanged frame based on the target quantization table to obtain a target scene unchanged frame; and replacing the original scene switching frame in the original video with the target scene switching frame, and replacing the original scene unchanged frame in the original video with the target scene unchanged frame to obtain the target video. The invention can effectively resist two geometric attacks, namely scaling attack and shearing attack at the same time.

Description

Dual video watermark embedding method, dual video watermark extracting device and electronic equipment
Technical Field
The present invention relates to the field of video information processing technologies, and in particular, to a dual video watermark embedding method and apparatus, and an electronic device.
Background
With the rapid development of information and communication technologies, digital video contents can be freely spread and used over a network, infringement occurs at times, and copyright protection is urgent. Video watermarking provides a solution for copyright tracking and verification of digital video content by imperceptibly embedding an identification (watermark) representing copyright information into the video, and extracting the watermark from the video to determine ownership thereof when copyright disputes are encountered.
Video after embedding the watermark may be subject to various intentional or unintentional attacks during propagation and use that make it difficult for the watermark to be extracted correctly. Common attack types are geometric attacks, signal processing attacks and time desynchronization attacks. Among these types of attacks, geometric attacks are the most difficult to resist, as they break the synchronicity of the locations where the watermarks are located at the time of embedding and extraction. Among these, scaling and cropping are the two most common geometric attacks of digital video content, but it is difficult for current watermarking algorithms to simultaneously resist both geometric attacks.
Disclosure of Invention
The invention provides a dual video watermark embedding method, a dual video watermark extracting device and electronic equipment, which are used for solving the defect that in the prior art, two geometric attacks, namely a scaling attack and a shearing attack, are difficult to be simultaneously and effectively resisted, and achieving the purpose of simultaneously and effectively resisting the two geometric attacks, namely the scaling attack and the shearing attack.
In a first aspect, the present invention provides a dual video watermark embedding method, comprising:
constructing a first re-watermark and a second re-watermark according to the copyright resource identification;
extracting at least one group of video frame sequences from an original video, wherein the video frame sequences comprise an original scene switching frame and an original scene unchanged frame;
embedding the first re-watermark into the original scene switching frame based on a first quantization step length to obtain a target scene switching frame; the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene change frame and the first watermark embedding strength;
embedding the second watermark into the original scene unchanged frame based on a target quantization table to obtain a target scene unchanged frame; the target quantization table is used for representing any position of the second watermark, the difference value of two adjacent components taking 2 times of the position as the initial position in the characteristic vector of the position of the target scene unchanged frame is larger than or equal to second watermark embedding strength under the condition that the bit data of the position is 0, and the difference value of two adjacent components taking 2 times of the position as the initial position in the characteristic vector of the target scene unchanged frame is smaller than or equal to the second watermark embedding strength under the condition that the bit data of the position is 1;
And replacing the original scene switching frame in the original video with the target scene switching frame, and replacing the original scene unchanged frame in the original video with the target scene unchanged frame to obtain the target video.
According to the dual video watermark embedding method provided by the invention, the first and second re-watermarks are constructed according to the copyright resource identification, and the method comprises the following steps:
splicing all the fixed-length word segments in the copyright resource identifier into a fixed-length character string;
coding the fixed-length character string to obtain a first code;
recombining the first code to obtain a two-dimensional 0/1 matrix serving as the first re-watermark;
splicing all the indefinite length fields in the copyright resource identifier into indefinite length character strings;
dividing the character string with the indefinite length into a plurality of character sub-strings according to bytes;
the character substrings are respectively encoded to obtain a plurality of second codes,
and respectively recombining the plurality of second codes to obtain a plurality of one-dimensional 0/1 vectors serving as the second watermark.
According to the dual video watermark embedding method provided by the invention, at least one group of video frame sequences are extracted from an original video, and the method comprises the following steps:
Extracting all original scene switching frames from an original video;
for each original scene-cut frame, determining a first ordinal video frame after the original scene-cut frame and a continuous first number of video frames after the first ordinal video frame as the original scene-unchanged frames; the first number is greater than or equal to the number of second encodings;
if the number of frames between two adjacent original scene switching frames is greater than or equal to the sum of the numerical value of the first ordinal number and the numerical value of the first number, the original scene switching frames of the two adjacent original scene switching frames and the corresponding original scene unchanged frames are reserved, otherwise, only the previous original scene switching frame and the corresponding original scene unchanged frames in the two adjacent original scene switching frames are reserved;
and combining each reserved original scene switching frame with each corresponding original scene unchanged frame to obtain a group of video frame sequences.
According to the dual video watermark embedding method provided by the invention, the first re-watermark is embedded into the original scene switching frame based on a first quantization step length to obtain a target scene switching frame, and the method comprises the following steps:
The brightness component of the original scene-switching frame is amplified to the minimum extent, so that the amplified height value of the original scene-switching frame can be divided by the height value of the first re-watermark, and the amplified width value of the original scene-switching frame can be divided by the width value of the first re-watermark;
partitioning the amplified brightness component of the original scene switching frame to obtain a plurality of partitions; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
for each block, calculating a target direct current coefficient based on the direct current coefficient of the block, the first quantization step size and corresponding bit data in the first re-watermark;
calculating a target pixel value of each pixel of each block based on an original pixel value of the pixel, a difference value between the target direct current coefficient and the direct current coefficient of the block and a width value and a height value of the block to obtain a first scene switching frame;
shrinking the first scene switching frame to obtain the target scene switching frame; the size of the target scene-cut frame is the same as the size of the original scene-cut frame.
According to the dual video watermark embedding method provided by the invention, the calculating of the target direct current coefficient based on the direct current coefficient of the block, the first quantization step length and the corresponding bit data in the first reprint comprises the following steps:
rounding the ratio between the direct current coefficient of the block and the first quantization step length to obtain a first numerical value;
taking the sum of the first numerical value and the corresponding bit data in the first reprint to leave 2 to obtain a second numerical value;
multiplying the first value minus 0.5 by the first quantization step under the condition that the second value is 1 to obtain the target direct current coefficient;
and under the condition that the second value is 0, multiplying the first value by the first quantization step length after adding 0.5 to obtain the target direct current coefficient.
According to the dual video watermark embedding method provided by the invention, the calculating the target pixel value of the pixel based on the original pixel value of the pixel, the difference value between the target direct current coefficient and the direct current coefficient of the block and the width value and the height value of the block comprises the following steps:
calculating the difference between the target direct current coefficient and the direct current coefficient of the block to obtain a third numerical value;
Calculating the ratio of the third value to the square root of the product between the width value and the height value of the block to obtain a fourth value;
and calculating the sum between the fourth numerical value and the original pixel value of the pixel to obtain the target pixel value of the pixel.
According to the dual video watermark embedding method provided by the invention, the second watermark is embedded into the original scene unchanged frame based on the target quantization table to obtain the target scene unchanged frame, and the method comprises the following steps:
detecting characteristic points of brightness components of the original scene unchanged frames of the second ordinal number in each group of video frame sequences to obtain a plurality of characteristic points; the value of the second ordinal number is greater than or equal to 1 and less than or equal to the number of the second codes;
screening first characteristic points with characteristic scale sizes within a preset range from the plurality of characteristic points;
constructing an embedded region with a preset size by taking each first characteristic point as a center;
removing the out-of-limit embedded region and the corresponding first characteristic points, screening a second number of target characteristic points which are ranked forward from the rest first characteristic points according to the sequence of the characteristic point intensities from large to small, and determining the embedded region corresponding to the target characteristic points as a target embedded region;
Amplifying the minimum scale of each target embedded region so that the height value and the width value of the amplified target embedded region can be divided by a fifth numerical value; the fifth value is a positive integer and the square of the fifth value is greater than or equal to the product between 8 and a sixth value, the sixth value being the respective number of bits of the second watermark of the second ordinal number;
constructing a feature vector of each amplified target embedded region;
embedding each bit data of the second watermark of the second ordinal number into the corresponding feature vector based on the target quantization table to obtain a target feature vector;
performing reverse construction on each target feature vector to obtain a first embedded region;
and reducing the first embedded area to the preset size to obtain the target scene unchanged frame.
According to the dual video watermark embedding method provided by the invention, the construction of the feature vector of each amplified target embedded region comprises the following steps:
partitioning each amplified target embedded region to obtain a plurality of target embedded region partitions; the number of the target embedded area blocks is the square of the fifth numerical value;
Discrete cosine transform is carried out on each target embedded region block to obtain a direct current coefficient of each target embedded region block, and the direct current coefficients of the target embedded region blocks are arranged into a block direct current coefficient matrix based on the sequence of each target embedded region block in the amplified target embedded region;
performing discrete cosine transform on the block direct current coefficient matrix to obtain a direct current-discrete cosine transform coefficient matrix;
screening a preset number of coefficients from the direct current-discrete cosine transform coefficient matrix to construct the amplified characteristic vector of the target embedded region.
According to the dual video watermark embedding method provided by the invention, the feature vector of the target embedded region after the amplification is constructed by screening the preset number of coefficients from the direct current-discrete cosine transform coefficient matrix comprises the following steps:
extracting a third number of coefficients from the main diagonal of the matrix of dc-discrete cosine transform coefficients; the third number is one-half of the fifth number;
extracting a coefficient at the upper right or lower left of the main diagonal, and extracting a coefficient at the lower left or upper right of the main diagonal, wherein the coefficients are extracted alternately in turn to obtain a fourth number of coefficients; the fourth number has a value that is the difference of one-fourth of the square of the fifth number and one-half of the fifth number;
Combining the extracted coefficients into a feature vector with a length value which is one fourth of the square of the fifth value, and determining a fifth number of coefficients which are ranked later from the feature vector as the feature vector of the amplified target embedded region; the fifth number is twice the sixth number.
According to the dual video watermark embedding method provided by the invention, each target feature vector is reversely constructed to obtain a first embedded region, and the method comprises the following steps:
replacing each coefficient extracted from the direct current-discrete cosine transform coefficient matrix with the target feature vector to obtain a target direct current-discrete cosine transform coefficient matrix;
performing discrete cosine inverse transformation on the target direct current-discrete cosine transformation coefficient matrix to obtain a target block direct current coefficient matrix;
and replacing the direct current coefficients in the target embedded region blocks at corresponding positions with each coefficient in the target block direct current coefficient matrix, performing discrete cosine transform on each replaced target embedded region block, and determining the first embedded region.
In a second aspect, the present invention further provides a dual video watermark extraction method, including:
Extracting at least one set of target video frame sequences from the target video; the target video frame sequence comprises a target scene switching frame and a target scene unchanged frame;
watermark extraction is carried out on the target scene switching frame based on a second quantization step length, so that a first re-watermark is obtained; the second quantization step length is the product between the square root of the product between the width value and the height value of the amplified target scene switching frame and the first watermark embedding strength;
watermark extraction is carried out on the unchanged frame of the target scene based on a target quantization table, so that a second watermark is obtained; the target quantization table is used for representing that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is less than 0;
and constructing a copyright resource identifier based on the first re-watermark and the second re-watermark.
According to the dual video watermark extraction method provided by the invention, watermark extraction is carried out on the target scene switching frame based on the second quantization step length to obtain a first re-watermark, and the method comprises the following steps:
Amplifying the brightness component of the target scene switching frame to the minimum extent so that the height value of the amplified target scene switching frame can be divided by the height value of the first re-watermark, and the width value of the amplified target scene switching frame can be divided by the width value of the first re-watermark;
partitioning the amplified brightness component of the target scene switching frame to obtain a plurality of partitions; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
and extracting corresponding bit data of the first re-watermark based on the direct current coefficient of each block and the second quantization step length for each block to obtain the first re-watermark.
According to the dual video watermark extraction method provided by the invention, the corresponding bit data of the first re-watermark is extracted based on the direct current coefficient of the block and the second quantization step length, and the method comprises the following steps:
the ratio between the direct current coefficient of the block and the second quantization step length is rounded downwards to obtain a seventh numerical value;
taking the remainder of the seventh numerical value pair 2 to obtain an eighth numerical value;
in the case that the eighth value is 1, determining the corresponding bit data of the first re-watermark to be 1;
In case that the eighth value is 0, the corresponding bit data of the first re-watermark is determined to be 0.
According to the dual video watermark extraction method provided by the invention, watermark extraction is carried out on the unchanged frame of the target scene based on the target quantization table to obtain a second watermark, and the method comprises the following steps:
detecting characteristic points of brightness components of the target scene unchanged frames of the third ordinal number in each group of target video frame sequences to obtain a plurality of characteristic points;
screening second characteristic points with characteristic scale sizes within a preset range from the plurality of characteristic points;
constructing an embedded region with a preset size by taking each second characteristic point as a center;
removing the out-of-limit embedded region and the corresponding second feature points;
screening a sixth number of target feature points which are ranked forward from the rest of the second feature points according to the sequence of the feature point intensities from large to small, and determining the embedded areas corresponding to the target feature points and the neighborhood points thereof as target embedded areas;
amplifying each target embedded region to the minimum extent so that the height value and the width value of the amplified target embedded region can be divided by a fifth value;
Constructing the amplified feature vector of the target embedded region;
and extracting the watermark from the amplified feature vector of the target embedded region based on a target quantization table to obtain the second watermark.
According to the dual video watermark extraction method provided by the invention, the construction of the copyright resource identifier based on the first and second re-watermarks comprises the following steps:
decoding the first re-watermark to obtain a fixed-length character string;
decoding the second watermark to obtain an indefinite length character string;
and constructing the copyright resource identifier based on the fixed-length character string and the variable-length character string.
In a third aspect, the present invention also provides a dual video watermark embedding apparatus, including:
the first construction module is used for constructing a first re-watermark and a second re-watermark according to the copyright resource identification;
the first extraction module is used for extracting at least one group of video frame sequences from the original video, wherein the video frame sequences comprise original scene switching frames and original scene unchanged frames;
the first embedding module is used for embedding the first heavy watermark into the original scene switching frame based on a first quantization step length to obtain a target scene switching frame; the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene change frame and the first watermark embedding strength;
The second embedding module is used for embedding the second watermark into the original scene unchanged frame based on a target quantization table to obtain a target scene unchanged frame; the target quantization table is used for representing any position of the second watermark, the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is larger than or equal to second watermark embedding strength under the condition that the bit data of the position is 0, and the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is smaller than or equal to second watermark embedding strength under the condition that the bit data of the position is 1;
and the replacing module is used for replacing the original scene switching frame in the original video with the target scene switching frame, and replacing the original scene unchanged frame in the original video with the target scene unchanged frame to obtain the target video.
In a fourth aspect, the present invention further provides a dual video watermark extraction apparatus, including:
a second extraction module for extracting at least one group of target video frame sequences from the target video; the target video frame sequence comprises a target scene switching frame and a target scene unchanged frame;
The third extraction module is used for extracting the watermark from the target scene switching frame based on the second quantization step length to obtain a first re-watermark; the second quantization step length is the product between the square root of the product between the width value and the height value of the amplified target scene switching frame and the first watermark embedding strength;
the fourth extraction module is used for extracting the watermark of the unchanged frame of the target scene based on the target quantization table to obtain a second watermark; the target quantization table is used for representing that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is less than 0;
and the second construction module is used for constructing the copyright resource identifier based on the first re-watermark and the second re-watermark.
In a fifth aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the dual video watermark embedding method according to any one of the first aspect or implements the dual video watermark extraction method according to any one of the second aspect when the program is executed.
In a sixth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a dual video watermark embedding method as described in any of the first aspects above, or implements a dual video watermark extraction method as described in any of the second aspects above.
In a seventh aspect, the present invention also provides a computer program product comprising a computer program which when executed by a processor implements a dual video watermark embedding method as described in any of the first aspects above, or implements a dual video watermark extraction method as described in any of the second aspects above.
In the process of embedding the first re-watermark, as the quantization coefficient changes along with the image size, the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene switching frame and the first watermark embedding strength, and the quantization interval divided by the first quantization step length also changes along with the image size, so that the synchronization between the quantization interval and the quantization coefficient can be ensured, and scaling attack can be effectively resisted; in the process of embedding the second watermark, because the influence of the small-scale offset of the embedded area on the difference value of two adjacent components in the feature vector of the watermark to be embedded of the target scene unchanged frame is monotonous, the sign of the difference value is basically not changed, the target quantization table is constructed based on the finding, when the watermark is embedded, by modifying the difference value of two adjacent components in the feature vector of the watermark to be embedded of the target scene unchanged frame, any position of the second watermark can be made, under the condition that the bit data of the position is 0, the difference value of two adjacent components taking the position as the starting position in the feature vector of the target scene unchanged frame is greater than or equal to the second watermark embedding strength, and under the condition that the bit data of the position is 1, the difference value of two adjacent components taking the position as the starting position in the feature vector of the target scene unchanged frame is less than or equal to the second watermark embedding strength, the small-scale offset of the embedded area caused by positioning error caused by the image can be compensated, so that the scaling attack can be effectively resisted and cut. Therefore, the invention can resist the two geometrical attacks of scaling attack and shearing attack at the same time.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a dual video watermark embedding method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a small scale offset attack suffered by an embedded region according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a target quantization table according to an embodiment of the present invention;
fig. 4 is a flow chart of a dual video watermark extraction method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a dual video watermark embedding apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a dual video watermark extraction apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The dual video watermark embedding method and the extraction method of the present invention are described below with reference to fig. 1 to 4.
Referring to fig. 1, fig. 1 is a flowchart of a dual video watermark embedding method according to an embodiment of the invention. As shown in fig. 1, the method may include the steps of:
step 101, constructing a first re-watermark and a second re-watermark according to a copyright resource identifier;
102, extracting at least one group of video frame sequences from an original video, wherein the video frame sequences comprise an original scene switching frame and an original scene unchanged frame;
step 103, embedding a first re-watermark into an original scene switching frame based on a first quantization step length to obtain a target scene switching frame; the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene change frame and the first watermark embedding strength;
104, embedding a second watermark into the original scene unchanged frame based on the target quantization table to obtain a target scene unchanged frame; the target quantization table is used for representing any position aiming at the second watermark, the difference value of two adjacent components taking 2 times of the position as the initial position in the characteristic vector of the unchanged frame of the target scene under the condition that the bit data of the position is 0 is larger than or equal to the second watermark embedding strength, and the difference value of two adjacent components taking 2 times of the position as the initial position in the characteristic vector of the unchanged frame of the target scene under the condition that the bit data of the position is 1 is smaller than or equal to the second watermark embedding strength;
Step 105, replacing the original scene switching frame in the original video with the target scene switching frame, and replacing the original scene unchanged frame in the original video with the target scene unchanged frame to obtain the target video.
In step 101, the composition of the copyright resource identifier is derived from the national standard GB/T40985-2021. The rights resource identification includes a plurality of fixed length fields and a plurality of indefinite length fields.
The first watermark and the second watermark are constructed according to the copyright resource identification, so that copyright attribution of the video can be managed, identified, tracked and authenticated conveniently, and the copyright dispute is reduced.
In step 102, a set of video frame sequences may include an original scene-cut frame and a corresponding original scene-invariant frame, where the original scene-cut frame is a video frame in the original video in which the scene cut occurs, and the original scene-invariant frame is a video frame following the original scene-cut frame. At least one set of video frame sequences is extracted from the original video.
It should be noted that, if the original video does not undergo scene switching, the first frame of the original video is taken as the original scene switching frame.
In step 103, the conventional quantization index modulation method is: the reference axis is divided into quantization intervals according to quantization step sizes, each quantization interval corresponding to one component (0 or 1) of the watermark. In the embedding stage, the quantization coefficients are quantized to corresponding quantization intervals by using an embedded quantizer according to watermark information to be embedded. In the extraction stage, the corresponding watermark is obtained by extracting quantization intervals in which the quantizer calculates the quantization coefficients.
However, if the watermarked image or video frame is scaled during the propagation, the quantized coefficients will also change with it, so that the quantized coefficients may fall into the wrong quantization interval, resulting in extraction errors.
In this step, the quantization factor is related to the image size, and the quantization factor also varies with the image size after image scaling. At the time of embedding, a quantization step for dividing a quantization interval is set to a first quantization stepI.e. the product between the square root of the product between the width value N and the height value M of the amplified original scene cut frame and the first watermark embedding strength a.
The quantization coefficients vary with the image size, and the reference axis is divided into quantization intervals using the first quantization step size, so that the quantization intervals also vary with the image size. Therefore, the synchronism of the quantization interval and the quantization coefficient can be ensured, and the scaling attack can be effectively resisted.
In step 104, since the small-scale offset of the embedded region after image scaling as shown in fig. 2 affects the difference value of the adjacent two components in the feature vector of the watermark to be embedded of the target scene invariant frame monotonously, the sign of the difference value is not substantially changed, and the target quantization table is constructed based on the finding.
As shown in fig. 3, the target quantization table is used for characterizing any position for the second watermark, under the condition that the bit data of the position is 0, the difference value of two adjacent components taking 2 times of the position as the starting position in the feature vector of the target scene unchanged frame is greater than or equal to the second watermark embedding strength, and under the condition that the bit data of the position is 1, the difference value of two adjacent components taking 2 times of the position as the starting position in the feature vector of the target scene unchanged frame is less than or equal to the second watermark embedding strength.
When the watermark is embedded, the difference value of two adjacent components in the feature vector of the watermark to be embedded of the target scene unchanged frame is modified based on the target quantization table, so that for any position of the second watermark, the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is larger than or equal to the second watermark embedding strength under the condition that the bit data of the position is 0, and the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is smaller than or equal to the second watermark embedding strength under the condition that the bit data of the position is 1, small-scale offset of an embedded area caused by positioning errors caused by image scaling can be compensated, and scaling and shearing attacks can be effectively resisted.
In step 105, the corresponding original scene switching frame in the original video is replaced by the target scene switching frame, and the corresponding original scene unchanged frame in the original video is replaced by the target scene unchanged frame, so as to obtain the target video after the double video watermark is embedded.
In the dual video watermark embedding method provided by the embodiment, in the process of embedding the first re-watermark, as the quantization coefficient can change along with the image size, the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene switching frame and the first watermark embedding strength, and the quantization interval divided by the first quantization step length also changes along with the image size, so that the synchronization between the quantization interval and the quantization coefficient can be ensured, and scaling attack can be effectively resisted; in the process of embedding the second watermark, because the small-scale offset of the embedded area after image scaling has monotonic influence on the difference value of two adjacent components in the feature vector of the target scene unchanged frame to be embedded with the watermark, the sign of the difference value is basically not changed, the target quantization table is constructed based on the finding, when the watermark is embedded, by modifying the difference value of two adjacent components in the feature vector of the target scene unchanged frame to be embedded with the watermark, any position of the second watermark can be made, under the condition that the bit data of the position is 0, the difference value of two adjacent components taking 2 times of the position as the starting position in the feature vector of the target scene unchanged frame is greater than or equal to the second watermark embedding strength, and under the condition that the bit data of the position is 1, the difference value of two adjacent components taking 2 times of the position as the starting position in the feature vector of the target scene unchanged frame is less than or equal to the second watermark embedding strength, and the small-scale offset of the embedded area caused by positioning error caused by the image can be compensated, so that scaling and shearing attack can be effectively resisted. Therefore, the embodiment can resist two geometrical attacks, namely a scaling attack and a shearing attack at the same time.
Based on the dual video watermark embedding method of the corresponding embodiment of fig. 1, in an example embodiment, step 101 may comprise the sub-steps of:
step 1011, splicing all the fixed-length word segments in the copyright resource identifier into a fixed-length character string;
step 1012, coding the fixed-length character string to obtain a first code;
step 1013, reorganizing the first code to obtain a two-dimensional 0/1 matrix as a first re-watermark;
step 1014, splicing all the indefinite length fields in the copyright resource identifier into indefinite length character strings;
step 1015, dividing the character string with the indefinite length into a plurality of character sub-strings according to bytes;
step 1016, encoding each of the plurality of character sub-strings to obtain a plurality of second encodings,
step 1017, recombining the plurality of second codes to obtain a plurality of one-dimensional 0/1 vectors as second watermarks.
In steps 1011 and 1014, the rights resource identifier is split into a plurality of fixed-length segments and a plurality of indefinite-length segments, the plurality of fixed-length segments are spliced into a fixed-length character string FW, and the plurality of indefinite-length segments are spliced into an indefinite-length character string SW.
In step 1012 and step 1013, the fixed-length character string FW is encoded to obtain a binary first code, and the first code is recombined to obtain a two-dimensional 0/1 matrix as a first re-watermark RS (FW).
In step 1015, the indefinite character string SW is divided into z character sub-strings in bytes.
In steps 1016 and 1017, each of the z character sub-strings is encoded to obtain a binary second code, the second code is recombined to obtain a one-dimensional 0/1 vector, and the obtained one-dimensional 0/1 vectorRS(SW 1 ),RS(SW 2 ),…,RS(SW z ) As a second re-watermark.
In this embodiment, since the length of the fixed-length character string is shorter than that of the indefinite-length character string, the fixed-length character string is directly encoded and recombined to obtain the first re-watermark, and the indefinite-length character string with a longer length is segmented and encoded and recombined to obtain the second re-watermark, so that the first re-watermark and the second re-watermark can be respectively constructed according to the characteristics of the fixed-length character string and the indefinite-length character string.
Based on the dual video watermark embedding method of the corresponding embodiment of fig. 1, in an example embodiment, step 102 may comprise the sub-steps of:
step 1021, extracting all original scene switching frames from the original video;
step 1022, for each original scene-switching frame, determining the video frames of the first ordinal number after the original scene-switching frame and the continuous first number of video frames after the video frames of the first ordinal number as original scene-unchanged frames; the first number is greater than or equal to the number of second encodings;
Step 1023, if the number of frames between two adjacent original scene switching frames is greater than or equal to the sum of the number of the first ordinal numbers and the number of the first ordinal numbers, retaining the original scene switching frames of the two adjacent original scene switching frames and the corresponding original scene unchanged frames, otherwise retaining only the previous original scene switching frame of the two adjacent original scene switching frames and the corresponding original scene unchanged frames;
step 1024, combining each reserved original scene switching frame and each corresponding original scene unchanged frame to obtain a group of video frame sequences.
In step 1021, optionally, d (H) is calculated by expression (1) f ,H f+1 ):
Wherein H is f A gray histogram for a luminance component of a previous frame; h f+1 Is at presentA gray histogram of a frame luminance component; d (H) f ,H f+1 ) Represents H f And H f+1 Is a correlation coefficient of (2); cov (H) f ,H f+1 ) Represents H f And H f+1 Is a covariance of (2); d (H) f ) Represents H f Is a variance of (2); d (H) f+1 ) Represents H f+1 Is a variance of (c).
At d (H) f ,H f+1 ) In case of < Thre, the current frame of the original video is the original scene change frame. Preferably, thre takes 0.6.
In step 1022, illustratively, taking the x-th frame as the first ordinal number, y as the first number, and z as the second number of codes, taking the x-th frame after each original scene switching frame as the initial original scene unchanged frame, and taking the consecutive y frames as the original scene unchanged frame sequence, wherein x is the key, and y is equal to or greater than z.
In step 1023, illustratively, if the number of frames between two adjacent original scene-switching frames is greater than or equal to x+y, the original scene-unchanged frame of the previous original scene-switching frame and the next original scene-switching frame of the two adjacent original scene-switching frames are not overlapped, and the original scene-switching frames of the two adjacent original scene-switching frames and the corresponding original scene-unchanged frames are reserved.
If the frame number between two adjacent original scene switching frames is less than x+y, the original scene unchanged frame of the previous original scene switching frame in the two adjacent original scene switching frames overlaps with the next original scene switching frame, and only the original scene switching frame of the previous original scene switching frame and the corresponding original scene unchanged frames are reserved.
It should be noted that, in the implementation, "preserving" refers to preserving the sequence number of the actual video frame, and the video frame that is not preserved is not deleted.
In step 1024, each original scene-cut frame and the corresponding original scene-invariant frames that are retained are assembled into a set of video frame sequences in time order.
In this embodiment, a video frame sequence including an original scene change frame and an original scene-invariant frame may be extracted from an original video.
Based on the dual video watermark embedding method of the corresponding embodiment of fig. 1, in an example embodiment, step 103 may comprise the sub-steps of:
step 1031, amplifying the brightness component of the original scene-switching frame to the minimum extent, so that the height value of the amplified original scene-switching frame can be divided by the height value of the first re-watermark, and the width value of the amplified original scene-switching frame can be divided by the width value of the first re-watermark;
step 1032, partitioning the brightness component of the amplified original scene change frame to obtain a plurality of partitions; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
step 1033, for each block, calculating a target dc coefficient based on the dc coefficient of the block, the first quantization step size, and corresponding bit data in the first re-watermark;
step 1034, calculating, for each pixel of each block, a target pixel value of the pixel based on an original pixel value of the pixel, a difference value between a target dc coefficient and a dc coefficient of the block, and a width value and a height value of the block, to obtain a first scene switching frame;
step 1035, shrinking the first scene switching frame to obtain a target scene switching frame; the size of the target scene-cut frame is the same as the size of the original scene-cut frame.
In step 1031, for the original scene-cut frames in each group of video frame sequences, the luminance component of the original scene-cut frame is minimally amplified, so that the height value M of the amplified original scene-cut frame can be divided by the height value of the first re-watermark, and the width value N of the amplified original scene-cut frame can be divided by the width value of the first re-watermark.
In step 1032, the luminance component of the amplified original scene-cut frame is segmented with the number of bits of the first re-watermark RS (FW) as the number of segments, to obtain a plurality of segments.
In step 1033, the dc coefficient of the block is a dc coefficient obtained by discrete cosine transforming the block. The target DC coefficient is the DC coefficient of the block after the DC coefficient is embedded by the first heavy watermark.
And processing the direct current coefficient of each block based on the first quantization step length and the corresponding bit data in the first re-watermark to obtain a target direct current coefficient.
In one possible implementation, step 1033 includes: rounding the ratio between the direct current coefficient of the block and the first quantization step length to obtain a first numerical value; taking the sum of the first numerical value and the corresponding bit data in the first re-watermark for 2 to obtain a second numerical value; under the condition that the second numerical value is 1, multiplying the first numerical value by a first quantization step length after subtracting 0.5 to obtain a target direct current coefficient; and under the condition that the second value is 0, multiplying the first value by the first quantization step length after adding 0.5 to obtain the target direct current coefficient.
Specifically, the target direct current coefficient is calculated by the following expression (2):
wherein round () is a rounding function; DC (direct current) ij The direct current coefficient of the block representing the ith row and jth column; RS (FW) ij ) Representing one bit of data in the first watermark to be embedded in the blocks of the ith row and jth column, RS (FW ij ) E {0,1}; m and N respectively represent the height and width of the amplified original scene change frame; alpha represents an adjustable first watermark embedding strength for balancing the invisibility and the robustness; preferably, α in this embodiment has a value of 0.16;representing a first quantization step size.
In step 1034, for each pixel of each block, processing the original pixel value of the pixel based on the difference between the target dc coefficient and the dc coefficient of the block and the width value and the height value of the block to obtain the target pixel value of the pixel, traversing all pixels of all blocks, and finally obtaining the amplified scene-switching frame after embedding the first watermark, i.e., the first scene-switching frame.
In one possible implementation, step 1034 includes: calculating the difference between the target direct current coefficient and the direct current coefficient of the block to obtain a third numerical value; calculating the ratio of the third value to the square root of the product between the width value and the height value of the block to obtain a fourth value; and calculating the sum between the fourth numerical value and the original pixel value of the pixel to obtain the target pixel value of the pixel.
Specifically, the target pixel value is calculated by the following expression (3):
wherein f ij (x, y) is the original pixel value of the ith row and jth column in the block with coordinates (x, y); f (f) ij ' x, y is the target pixel value of (x, y) coordinates in the ith row and jth column of the partition; a and b are the height value and the width value of the block respectively; DC (direct current) ij The direct current coefficient of the block representing the ith row and jth column;the target dc coefficient of the block of the i-th row and j-th column is represented.
In step 1035, since the first scene-cut frame is an enlarged scene-cut frame after embedding the first watermark, the first scene-cut frame is reduced to the same size as the original scene-cut frame, and the target scene-cut frame is obtained.
In this embodiment, a video resolution-based adaptive quantization index modulation video watermark embedding method is provided, in which a segmented direct current coefficient is used as a quantization coefficient, the segmented direct current coefficient varies with the image size, and a first quantization step is used to divide a reference axis into a plurality of quantization intervals, so that the quantization intervals also vary with the image size. Therefore, the synchronism of the quantization interval and the quantization coefficient can be ensured, and the scaling attack can be effectively resisted.
In an example embodiment, step 104 may include the sub-steps of:
Step 1041, detecting a feature point of a luminance component of an original scene unchanged frame of a second ordinal number in each group of video frame sequences to obtain a plurality of feature points; the numerical value of the second ordinal number is greater than or equal to 1 and less than or equal to the number of the second codes;
step 1042, screening out a first feature point with a feature scale within a preset range from a plurality of feature points;
step 1043, constructing an embedded region with a preset size by taking each first feature point as a center;
step 1044, eliminating the out-of-limit embedded region and the corresponding first feature points, screening a second number of target feature points with a front ranking from the rest first feature points according to the sequence of the feature point intensities from large to small, and determining the embedded region corresponding to the target feature points as a target embedded region;
step 1045, amplifying the minimum scale of each target embedded region, so that the height value and the width value of the amplified target embedded region can be divided by the fifth value; the fifth value is a positive integer and the square of the fifth value is greater than or equal to the product between 8 and a sixth value, the sixth value being the corresponding number of bits of the second watermark of the second ordinal number;
step 1046, constructing a feature vector of each amplified target embedded region;
Step 1047, embedding each bit data of the second watermark of the second ordinal number into a corresponding feature vector based on the target quantization table to obtain a target feature vector;
step 1048, performing inverse construction on each target feature vector to obtain a first embedded region;
step 1049, shrinking the first embedded region to a preset size to obtain a target scene unchanged frame. The preset size is the same as the original scene unchanged frame.
In step 1041, illustratively, z represents the number of the second encodings and v represents the second ordinal number, 1.ltoreq.v.ltoreq.z. The luminance component of the v (1.ltoreq.v.ltoreq.z) th original scene invariant frame in each group of video frame sequences can be subjected to feature point detection by a Scale-invariant feature transform (Scale-invariant feature transform, SIFT) algorithm or an acceleration robust feature (Speeded up Robust Features, SURF) algorithm to obtain a plurality of feature points. The present embodiment is not limited to these two feature detection algorithms.
In step 1042, illustratively, [ s ] min ,s max ]Representing a preset range s min Sum s max Is an empirical value. Screening out feature scale size from multiple feature points to be in [ s ] min ,s max ]A first feature point within.
In step 1043, the shape of the embedded area may be square, and the embedded area is a preset size, which is not limited thereto.
Illustratively, a square embedded region is constructed by the following expression (4):
|x-x i |·|y-y i |=(ωs i ) 2 (4)
wherein s is i A feature scale size representing a first feature point having an i-th high intensity ranking; omega represents an empirical value controlling the size of the square embedded region; (x) i ,y i ) Spatial coordinates representing a first feature point having an intensity ranking of ith high; (x, y) represents the spatial coordinates of the square embedded region. Preferably, S min And S is max And is 30 and 60, respectively, and ω is 5.
In step 1044, the out-of-limit embedded region and the corresponding first feature point are removed, that is, if the region overlapping phenomenon occurs, the first feature point and its corresponding embedded region with relatively smaller intensity are removed. And then, sequencing the remaining first characteristic points according to the sequence of the characteristic point intensities from large to small, taking the first K first characteristic points with the maximum intensity in the remaining first characteristic points as target characteristic points, and taking an embedded area corresponding to the target characteristic points as a target embedded area, namely, an embedded area to be embedded with a second watermark. Preferably, K has a value of 3.
In step 1045, B illustratively represents a fifth value, B ε N + And B is 2 Not less than 8L; l represents a sixth value, namely RS (SW v ) (1. Ltoreq.v. Ltoreq.z), RS (SW) v ) Representing a second re-watermark. Preferably, B has a value of 24 and L has a value of 64.
And amplifying the minimum scale of each target embedded region so that the height value and the width value of the amplified target embedded region can be divided by B.
In step 1046, the feature vector for each of the amplified target embedded regions may be constructed by:
step 10461, partitioning each amplified target embedded region to obtain multiple target embedded region partitions; the number of the target embedded area blocks is the square of a fifth numerical value;
step 10462, performing discrete cosine transform on each target embedded region block to obtain a direct current coefficient of each target embedded region block, and arranging the direct current coefficients of the target embedded region blocks into a block direct current coefficient matrix based on the sequence of each target embedded region block in the amplified target embedded region;
step 10463, performing discrete cosine transform on the segmented direct current coefficient matrix to obtain a direct current-discrete cosine transform coefficient matrix;
and 10464, screening a preset number of coefficients from the direct current-discrete cosine transform coefficient matrix to construct the feature vector of the amplified target embedded region.
In step 10461, B represents a fifth value, and b×b is taken as the number of target embedded region partitions, and each of the amplified target embedded regions is partitioned to obtain a plurality of target embedded region partitions.
In step 10462, discrete cosine transform is performed on each target embedded region block to obtain a block dc coefficient of each target embedded region block, and the block dc coefficients of each target embedded region block are arranged into a b×b block dc coefficient matrix according to the order of each target embedded region block in the amplified target embedded region.
In step 10463, a discrete cosine transform operation is performed on the segmented DC coefficient matrix to obtain a DC-discrete cosine transform coefficient matrix, i.e., a DC-DCT coefficient matrix.
In step 10464, a predetermined number of coefficients are selected from the matrix of DC-DCT coefficients, and feature vectors for the enlarged target embedded region are constructed based on the selected coefficients.
In one possible implementation, step 10464 can include the sub-steps of:
step 104641, extracting a third number of coefficients from the main diagonal of the DC-DCT coefficient matrix; the third number is one-half of the fifth number;
104642, extracting a coefficient at the upper right or lower left of the main diagonal, and extracting a coefficient at the lower left or upper right of the main diagonal alternately in turn to obtain a fourth number of coefficients; the fourth number has a value that is the difference of one-fourth of the square of the fifth number and one-half of the fifth number;
step 104643, combining the extracted coefficients into a feature vector with a length value which is one fourth of the square of the fifth value, and determining a fifth number of coefficients which are ranked later from the feature vector as the feature vector of the amplified target embedded region; the fifth number is twice the sixth number.
In step 104641, illustratively, B represents a fifth value and the third quantity has a value of B/2. B/2 coefficients are extracted from the main diagonal of the DC-DCT coefficient matrix.
In step 104642, the fourth quantity has a value of B 2 4-B/2, extracting a coefficient of the upper right (or lower left) of the main diagonal, and then extracting a coefficient of the lower left (or upper right) of the main diagonal, alternately extracting in turn, and sharing B 2 4-B/2 coefficients.
In step 104643, L represents a sixth value, and the coefficients extracted in steps 104641 and 104642 are combined to have a length value B 2 And/4, and selecting the rear 2L coefficients from the feature vectors as the feature vectors of the amplified target embedded region.
In this embodiment, the feature vector of the target embedded region after the amplification may be constructed based on a preset number of coefficients selected from the DC-DCT coefficient matrix.
In step 1047, the method may be performed byRepresenting the target quantization table shown in fig. 3 at the time of watermark embedding. When the watermark is embedded, modifying the difference value of two adjacent components in the feature vector of the target scene unchanged frame to be embedded with the watermark based on the target quantization table so that the difference value of two adjacent components in the feature vector after the watermark is embedded meets the expression.
The following expression (5) can be obtained by converting this expression. Embedding each bit data of the second watermark into a corresponding feature vector by the following expression (5) to obtain a target feature vector:
wherein k=0, 1,. -%, L-1;and->Respectively representing two adjacent components in the feature vector to be embedded with the watermark; />And->Respectively indicate->And->A value corresponding to the watermark embedded;d represents the embedding strength of the second watermark, satisfies D not less than 0, and is used for balancing the invisibility and the robustness of the watermark. Preferably, D has a value of 120./ >
In step 1048, each target feature vector may be constructed inversely to obtain a first embedded region by:
step 10481, replacing each coefficient extracted from the direct current-discrete cosine transform coefficient matrix with a target feature vector to obtain a target direct current-discrete cosine transform coefficient matrix;
step 10482, performing inverse discrete cosine transform on the target direct current-discrete cosine transform coefficient matrix to obtain a target block direct current coefficient matrix;
step 10483, according to expression (2), replacing each coefficient in the target block direct current coefficient matrix with a direct current coefficient in a target embedded region block at a corresponding position, performing discrete cosine transform on each replaced target embedded region block, and determining a first embedded region.
In this embodiment, when the watermark is embedded, the difference value between two adjacent components in the feature vector of the watermark to be embedded of the target scene invariant frame is modified based on the target quantization table, so that small scale offset of an embedded region caused by positioning error due to image scaling can be compensated, and scaling and shearing attacks can be effectively resisted.
Referring to fig. 4, fig. 4 is a flowchart of a dual video watermark extraction method according to an embodiment of the invention. As shown in fig. 4, the method may include the steps of:
Step 401, extracting at least one group of target video frame sequences from the target video; the target video frame sequence comprises a target scene switching frame and a target scene unchanged frame;
step 402, watermark extraction is carried out on the target scene switching frame based on the second quantization step length, and a first re-watermark is obtained; the second quantization step length is the product between the square root of the product between the width value and the height value of the amplified target scene switching frame and the first watermark embedding strength;
step 403, watermark extraction is carried out on the unchanged frame of the target scene based on the target quantization table, so as to obtain a second watermark; the target quantization table is used for representing that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is larger than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is smaller than 0;
and 404, constructing a copyright resource identifier based on the first re-watermark and the second re-watermark.
In step 401, all target scene switching frames are extracted from the target video, and d (H) can be calculated by expression (1) f ,H f+1 ) At d (H) f ,H f+1 ) And under the condition of less than Thre, the current frame of the target video is a target scene switching frame. Preferably, thre takes 0.7, and the larger value is to compensate for the inaccuracy of scene change frame extraction possibly caused by attack.
The concept of extracting the target scene unchanged frame corresponding to the target scene change frame from the target video is similar to that in the steps 1022 and 1023, and will not be described herein.
And combining each reserved target scene switching frame with each corresponding target scene unchanged frame to obtain a group of video frame sequences.
In step 402, the quantization coefficients are associated with the image size, and the quantization coefficients also vary with the image size after scaling. At the time of extraction, the quantization step used for dividing the quantization interval is set to the second quantization stepI.e. the product between the square root of the product between the width value n and the height value m of the amplified target scene-switching frame and the first watermark embedding strength a, m representing the height value of the amplified target scene-switching frame, n representing the width value of the amplified target scene-switching frame.
The quantization coefficients vary with the image size, and the reference axis is divided into quantization intervals using a second quantization step, so that the quantization intervals also vary with the image size. Therefore, the synchronism of the quantization interval and the quantization coefficient can be ensured, and the scaling attack can be effectively resisted.
In step 403, since the small-scale offset of the embedded region after image scaling affects the difference value of the adjacent two components in the feature vector of the watermark to be extracted of the target scene invariant frame monotonically, the sign of the difference value is not substantially changed, and the target quantization table is constructed based on the finding.
As shown in fig. 3, the target quantization table is used to represent that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value between two adjacent components in the feature vector of the watermark to be extracted of the target scene invariant frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value between two adjacent components in the feature vector of the watermark to be extracted of the target scene invariant frame is less than 0.
When the watermark is extracted, the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is modified based on the target quantization table, so that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is less than 0, small-scale offset of an embedded area caused by positioning errors caused by image scaling can be compensated, and scaling and shearing attacks can be effectively resisted.
In step 404, a rights resource identification is constructed from the first and second re-watermarks.
Specifically, decoding the first re-watermark to obtain a fixed-length character string; decoding the second watermark to obtain an indefinite length character string; and constructing the copyright resource identifier based on the fixed-length fields included in the fixed-length character string and the variable-length fields included in the variable-length character string.
In the dual video watermark extraction method provided by the embodiment, in the process of extracting the first re-watermark, the quantization coefficient is changed along with the image size, and the reference axis is divided into a plurality of quantization intervals by adopting the second quantization step length, so that the quantization intervals are also changed along with the image size. Therefore, the synchronism of the quantization interval and the quantization coefficient can be ensured, so that scaling attack can be effectively resisted; in the process of extracting the second watermark, because the influence of small-scale offset of the embedded area after image scaling on the difference value of two adjacent components in the feature vector of the watermark to be extracted of the unchanged frame of the target scene is monotonous, the positive sign and the negative sign of the difference value are not basically changed, and a target quantization table is constructed based on the discovery; when the watermark is extracted, the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is modified based on the target quantization table, so that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is less than 0, small scale offset of an embedded area caused by positioning errors caused by image scaling can be compensated, and scaling and shearing attacks can be effectively resisted. Therefore, the embodiment can resist two geometrical attacks, namely a scaling attack and a shearing attack at the same time.
Based on the dual video watermark extraction method of the corresponding embodiment of fig. 4, in an example embodiment, step 402 may comprise the sub-steps of:
step 4021, amplifying the brightness component of the target scene switching frame to the minimum extent, so that the height value of the amplified target scene switching frame can be divided by the height value of the first re-watermark, and the width value of the amplified target scene switching frame can be divided by the width value of the first re-watermark;
step 4022, partitioning the brightness component of the amplified target scene switching frame to obtain a plurality of partitions; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
step 4023, extracting corresponding bit data of the first re-watermark based on the direct current coefficient and the second quantization step length of each block to obtain the first re-watermark.
In step 4021, for each group of target scene-switching frames in the video sequence, the luminance component of the target scene-switching frame is minimally amplified, so that the height value m of the amplified target scene-switching frame is divisible by the height value of the first watermark, and the width value n of the amplified target scene-switching frame is divisible by the width value of the first watermark.
In step 4022, the number of watermark bits of the first re-watermark is taken as the number of blocks, and the luminance component of the amplified target scene switching frame is blocked to obtain a plurality of blocks.
In step 4023, the ratio between the direct current coefficient of the block and the second quantization step may be rounded down to obtain a seventh value; surplus is carried out on the seventh numerical value pair 2, and an eighth numerical value is obtained; in the case that the eighth value is 1, determining the corresponding bit data of the first re-watermark as 1; in case the eighth value is 0, the corresponding bit data of the first re-watermark is determined to be 0.
In particular, it is possible toRepresenting the target quantization table shown in fig. 3 at the time of watermark extraction. When the watermark is extracted, the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is modified based on the target quantization table, so that the difference value of two adjacent components in the feature vector after the watermark is extracted meets the expression.
The following expression (6) can be obtained by converting this expression. The corresponding bit data of the first re-watermark may be extracted by the following expression (6):
wherein floor () is a downward rounding function; DC' ij The direct current coefficient of the block representing the ith row and jth column; RS (FW' ij ) Representation ofOne bit of data of the first re-watermark extracted from the block of the ith row and the jth column;representing a second quantization step size; alpha represents an adjustable first watermark embedding strength for balancing the invisibility and the robustness; preferably, α in this embodiment has a value of 0.16.
In this embodiment, a video resolution-based adaptive quantization index modulation video watermark extraction method is provided, in which a segmented direct current coefficient is used as a quantization coefficient, the segmented direct current coefficient varies with the image size, and a second quantization step is used to divide a reference axis into a plurality of quantization intervals, so that the quantization intervals also vary with the image size. Therefore, the synchronism of the quantization interval and the quantization coefficient can be ensured, and the scaling attack can be effectively resisted.
Based on the dual video watermark extraction method of the corresponding embodiment of fig. 4, in an example embodiment, step 403 may comprise the sub-steps of:
step 4031, detecting the feature points of the luminance components of the unchanged frames of the target scene of the third ordinal number in each group of target video frame sequences to obtain a plurality of feature points;
step 4032, screening out a second characteristic point with the characteristic scale within a preset range from the plurality of characteristic points;
Step 4033, constructing an embedded region with a preset size by taking each second characteristic point as a center;
step 4034, eliminating the out-of-limit embedded region and the corresponding second feature points;
step 4035, screening a sixth number of target feature points which are ranked forward from the rest second feature points according to the sequence of the feature point intensities from large to small, and determining the target feature points and the embedding areas corresponding to the neighborhood points thereof as target embedding areas;
step 4036, performing minimum amplification on each target embedded region, so that the height value and the width value of the amplified target embedded region can be divided by the fifth value;
step 4037, constructing a feature vector of the amplified target embedded region;
step 4038, watermark extraction is performed on the feature vector of the amplified target embedded region based on the target quantization table, so as to obtain a second watermark.
In step 4031, illustratively, z represents a preset number and v represents a third ordinal number, 1.ltoreq.v.ltoreq.z. The luminance component of the v (1.ltoreq.v.ltoreq.z) th target scene invariant frame in each group of video frame sequences can be subjected to feature point detection by a Scale-invariant feature transform (Scale-invariant feature transform, SIFT) algorithm or an acceleration robust feature (Speeded up Robust Features, SURF) algorithm to obtain a plurality of feature points. The present embodiment is not limited to these two feature detection algorithms.
In step 4032, illustratively, [0.4s ] min ,1.5s max ]Representing a preset range s min Sum s max Is an empirical value. Screening out characteristic scale size from a plurality of characteristic points to be in [0.4s ] min ,1.5s max ]A second feature point within.
In step 4033, an embedded region of a predetermined size may be configured with each second feature point as a center in a similar manner to the above expression (4), and will not be described here.
In step 4034, the out-of-bound embedded region and the corresponding second feature point are removed, i.e., if the region overlapping phenomenon occurs, the second feature point and its corresponding embedded region with relatively smaller intensity are removed.
In step 4035, the remaining second feature points are ordered according to the order of the feature point intensities from large to small, the first O (O is greater than or equal to K) second feature points with the largest intensity in the remaining second feature points are used as target feature points, and the embedded region corresponding to the 8 neighborhood points corresponding to the target feature points is used as a target embedded region, namely the embedded region of the second watermark to be extracted. Preferably, O has a value of 10. The 8 neighborhood points are selected to compensate for the positional shift of the embedded region caused by the positioning error.
In step 4036, B illustratively represents a fifth value, which is the same as the fifth value in the above embodiment.
And amplifying the minimum scale of each target embedded region so that the height value and the width value of the amplified target embedded region can be divided by B.
In step 4037, the manner of constructing the feature vector of the amplified target embedded region is similar to the above-mentioned steps 10461-10464, and will not be described here.
In step 4038, one may passAnd extracting the watermark from the characteristic vector of the amplified target embedded region to obtain a second watermark.
In this embodiment, when extracting the watermark, the difference value between two adjacent components in the feature vector of the watermark to be extracted of the target scene invariant frame is modified based on the target quantization table, so that small scale offset of an embedded region caused by positioning error due to image scaling can be compensated, and scaling and shearing attacks can be effectively resisted.
The effectiveness of the above-described dual video watermark embedding and extraction method is verified by experiments.
(1) Evaluation mode of dual video watermark embedding and extracting method
For the dual video watermark embedding method, it can be evaluated by mean peak signal-to-noise ratio (Mean Peak Signal to Noise Ratio, mps nr), the higher the mps nr value, the better the invisibility of the watermark. The MPSNR value can be calculated by the following expression (7):
Wherein K represents the number of video frames in the video in which the watermark is embedded; m and N represent the height and width of the video frame, respectively; f (i, j) represents the gray value of the pixel point with coordinates (i, j) in the original video frame; f' (i, j) represents the gray value of the pixel with coordinates (i, j) in the video frame after embedding the watermark; max (F (i, j)) represents the maximum value of the gray values of all pixels in the video frame, generally taken as 255.
For the dual video watermark extraction method, it can be evaluated by Byte Error Rate (BER). The byte error rate is the ratio of the number of erroneous bytes to the total number of bytes, comparing the extracted watermark with the original watermark, the lower the byte error rate, the better the robustness of the watermark.
Original watermark sequence w= [ W ] 0 ,w 1 ,…,w n-1 ]And extracted watermark sequenceThe byte error rate therebetween can be calculated by the following expression (8):
(2) Evaluation result of dual video watermark embedding and extracting method
For the dual video watermark embedding method, the average MPSNR after 124 videos are embedded with dual watermarks is 46.23. Typically, an MPSNR of greater than 40dB represents a very good visual quality, with good invisibility of the watermark.
For the dual video watermark extraction method, respectively implementing multiple signal processing attacks on the 124 watermark-embedded MP4 format videos obtained by the dual video watermark embedding method embodiment, wherein specific attack types and parameter settings are shown in table one, extracting the watermarks in the attacked watermark video by using the dual video watermark extraction method embodiment, and comparing the extracted watermarks with the original watermarks to obtain the average byte error rate of the 124 extracted watermarks, wherein the average byte error rate is shown in table one:
List one
And respectively implementing various geometric attacks on the 124 watermark-embedded MP4 format videos obtained by the embodiment of the double video watermark embedding method, wherein specific attack types and parameter settings are shown in a table II, extracting the watermarks in the attacked watermark-containing videos by using the embodiment of the double video watermark extracting method, and comparing the watermarks with the original watermarks to obtain the average byte error rate of the 124 extracted watermarks, wherein the average byte error rate is shown in the table II:
watch II
The 10 watermark-embedded MP4 format videos obtained by the embodiment of the dual video watermark embedding method are respectively uploaded to three network media platforms, then the uploaded videos are downloaded to carry out robustness test of the watermark, and the whole process carries out various attacks such as transcoding, compression, resolution change and the like on the videos. Platform 1 and platform 3 can download four resolution videos, 1080P (1920×1080), 720P (1280×720), 480P (850×480) and 360P (640×360), respectively, while platform 2 can download two resolution videos, 720P (1280×720) and 480P (848×478), respectively. The watermark in the downloaded video is extracted by using the embodiment of the dual video watermark extraction method, and compared with the original watermark, and the average byte error rate of 10 extracted watermarks is shown in table three.
Watch III
From the results shown in the first, second and third tables, the watermark can be extracted very accurately under the premise of ensuring good invisibility in the face of common signal processing attacks, geometric attacks, frame adjustment attacks and network media platform propagation attacks, so that the watermark extraction method and the device can be proved to be capable of effectively resisting various signal processing attacks, geometric attacks, frame adjustment attacks and network media platform propagation attacks, and have stronger robustness and high efficiency.
The dual video watermark embedding apparatus and the extracting apparatus provided by the present invention will be described below, and the dual video watermark embedding apparatus and the extracting apparatus described below and the dual video watermark embedding method and the extracting method described above may be referred to correspondingly to each other.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a dual video watermark embedding apparatus according to an embodiment of the invention. As shown in fig. 5, the apparatus may include:
a first construction module 10, configured to construct a first watermark and a second watermark according to the copyright resource identifier;
a first extraction module 20, configured to extract at least one set of video frame sequences from an original video, where the video frame sequences include an original scene change frame and an original scene unchanged frame;
A first embedding module 30, configured to embed the first re-watermark into the original scene-switching frame based on the first quantization step size, to obtain a target scene-switching frame; the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene change frame and the first watermark embedding strength;
a second embedding module 40, configured to embed the second watermark into the original scene unchanged frame based on a target quantization table, to obtain a target scene unchanged frame; the target quantization table is used for representing any position of the second watermark, the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is larger than or equal to second watermark embedding strength under the condition that the bit data of the position is 0, and the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is smaller than or equal to second watermark embedding strength under the condition that the bit data of the position is 1;
the replacing module 50 is configured to replace an original scene-switching frame in the original video with a target scene-switching frame, and replace an original scene-unchanged frame in the original video with a target scene-unchanged frame, so as to obtain a target video.
In an example embodiment, the first building module 10 is specifically configured to:
splicing all the fixed-length word segments in the copyright resource identifier into a fixed-length character string;
coding the fixed-length character string to obtain a first code;
recombining the first code to obtain a two-dimensional 0/1 matrix serving as a first re-watermark;
splicing all the indefinite length fields in the copyright resource identifier into an indefinite length character string;
dividing the character string with the indefinite length into a plurality of character sub-strings according to bytes;
encoding the plurality of character sub-strings respectively to obtain a plurality of second codes,
and respectively recombining the plurality of second codes to obtain a plurality of one-dimensional 0/1 vectors serving as second watermarking.
In an example embodiment, the first extraction module 20 is specifically configured to:
extracting all original scene switching frames from an original video;
for each original scene-switching frame, determining the video frames of the first ordinal number after the original scene-switching frame and the video frames of the continuous first number after the video frames of the first ordinal number as original scene-unchanged frames; the first number is greater than or equal to the number of second encodings;
if the frame number between two adjacent original scene switching frames is larger than or equal to the sum of the numerical value of the first ordinal number and the numerical value of the first quantity, retaining the original scene switching frames of the two adjacent original scene switching frames and the corresponding original scene unchanged frames, otherwise, retaining only the previous original scene switching frame and the corresponding original scene unchanged frames in the two adjacent original scene switching frames;
And combining each reserved original scene switching frame with each corresponding original scene unchanged frame to obtain a group of video frame sequences.
In one example embodiment, the first embedding module 30 includes:
a first amplifying unit, configured to amplify the luminance component of the original scene-switching frame to a minimum extent, so that the height value of the amplified original scene-switching frame is divisible by the height value of the first watermark, and the width value of the amplified original scene-switching frame is divisible by the width value of the first watermark;
the first blocking unit is used for blocking the brightness component of the amplified original scene switching frame to obtain a plurality of blocks; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
a first calculation unit for calculating, for each block, a target direct current coefficient based on the direct current coefficient of the block, the first quantization step size, and corresponding bit data in the first re-watermark;
a second calculating unit, configured to calculate, for each pixel of each block, a target pixel value of the pixel based on an original pixel value of the pixel, a difference value between the target dc coefficient and the dc coefficient of the block, and a width value and a height value of the block, to obtain a first scene switching frame;
The first shrinking unit is used for shrinking the first scene switching frame to obtain a target scene switching frame; the size of the target scene-cut frame is the same as the size of the original scene-cut frame.
In an example embodiment, the first computing unit is specifically configured to:
rounding the ratio between the direct current coefficient of the block and the first quantization step length to obtain a first numerical value;
taking the sum of the first numerical value and the corresponding bit data in the first re-watermark for 2 to obtain a second numerical value;
under the condition that the second numerical value is 1, multiplying the first numerical value by a first quantization step length after subtracting 0.5 to obtain a target direct current coefficient;
and under the condition that the second value is 0, multiplying the first value by the first quantization step length after adding 0.5 to obtain the target direct current coefficient.
In an example embodiment, the second computing unit is specifically configured to:
calculating the difference between the target direct current coefficient and the direct current coefficient of the block to obtain a third numerical value;
calculating the ratio of the third value to the square root of the product between the width value and the height value of the block to obtain a fourth value;
and calculating the sum between the fourth numerical value and the original pixel value of the pixel to obtain the target pixel value of the pixel.
In one example embodiment, the second embedding module 40 includes:
the first detection unit is used for detecting the characteristic points of the brightness components of the original scene unchanged frames of the second ordinal number in each group of video frame sequences to obtain a plurality of characteristic points; the value of the second ordinal number is greater than or equal to 1 and less than or equal to the number of the second codes;
the first screening unit is used for screening first characteristic points with characteristic scale sizes within a preset range from a plurality of characteristic points;
a first construction unit configured to construct an embedding region of a preset size centering on each first feature point;
the first eliminating unit is used for eliminating the out-of-limit embedded region and the corresponding first characteristic points;
the second screening unit is used for screening a second number of target feature points which are ranked at the front from the rest first feature points according to the sequence of the feature point intensities from the big to the small;
a first determining unit, configured to determine an embedding area corresponding to the target feature point as a target embedding area;
the second amplifying unit is used for amplifying the minimum scale of each target embedded region so that the height value and the width value of the amplified target embedded region can be divided by the fifth value; a fifth value is a positive integer and the square of the fifth value is greater than or equal to the product between 8 and a sixth value, the sixth value being the number of bits of the second watermark of the second ordinal number;
A first construction unit for constructing a feature vector of each of the amplified target embedded regions;
the embedding unit is used for embedding each bit data of the second watermark of the second ordinal number into the corresponding feature vector based on the target quantization table to obtain a target feature vector;
the reverse construction unit is used for carrying out reverse construction on each target feature vector to obtain a first embedded region;
and the second shrinking unit is used for shrinking the first embedded area to a preset size to obtain the target scene unchanged frame.
In an example embodiment, the first building element is specifically configured to:
the partitioning subunit is used for partitioning each amplified target embedded region to obtain a plurality of target embedded region partitions; the number of the target embedded area blocks is the square of the fifth numerical value;
an arrangement subunit, configured to perform discrete cosine transform on each of the target embedded region blocks to obtain a direct current coefficient of each of the target embedded region blocks, and arrange the direct current coefficients of the target embedded region blocks into a block direct current coefficient matrix based on an order of each of the target embedded region blocks in the amplified target embedded region;
A transformation subunit, configured to perform discrete cosine transformation on the block direct current coefficient matrix to obtain a direct current-discrete cosine transformation coefficient matrix;
and the screening subunit is used for screening a preset number of coefficients from the direct current-discrete cosine transform coefficient matrix to construct the feature vector of the amplified target embedded region.
In an example embodiment, the screening subunit is specifically configured to:
extracting a third number of coefficients from the main diagonal of the matrix of dc-discrete cosine transform coefficients; the third number is one-half of the fifth number;
extracting a coefficient at the upper right or lower left of the main diagonal, and extracting a coefficient at the lower left or upper right of the main diagonal alternately in turn to obtain a fourth number of coefficients; the fourth number has a value that is the difference of one-fourth of the square of the fifth number and one-half of the fifth number;
combining the extracted coefficients into a feature vector with a length value which is one fourth of the square of a fifth value, and determining a fifth number of coefficients which are ranked later from the feature vector as the feature vector of the amplified target embedded region; the fifth number is twice the sixth number.
In an example embodiment, the inverse construction unit is specifically configured to:
Replacing each coefficient extracted from the direct current-discrete cosine transform coefficient matrix with a target feature vector to obtain a target direct current-discrete cosine transform coefficient matrix;
performing discrete cosine inverse transformation on the target direct current-discrete cosine transformation coefficient matrix to obtain a target block direct current coefficient matrix;
and replacing the direct current coefficients in the target embedded region blocks at corresponding positions with each coefficient in the target block direct current coefficient matrix, performing discrete cosine transform on each replaced target embedded region block, and determining the first embedded region.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a dual video watermark extraction apparatus according to an embodiment of the invention. As shown in fig. 6, the apparatus may include:
a second extraction module 60 for extracting at least one set of target video frame sequences from the target video; the target video frame sequence comprises a target scene switching frame and a target scene unchanged frame;
a third extraction module 70, configured to extract the watermark from the target scene switching frame based on the second quantization step size, so as to obtain a first re-watermark; the second quantization step length is the product between the square root of the product between the width value and the height value of the amplified target scene switching frame and the first watermark embedding strength;
A fourth extraction module 80, configured to extract the watermark from the unchanged frame of the target scene based on the target quantization table, so as to obtain a second watermark; the target quantization table is used for representing that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is larger than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is smaller than 0;
a second construction module 90 is configured to construct a rights resource identifier based on the first watermark and the second watermark.
In one example embodiment, the third extraction module 70 includes:
a third amplifying unit, configured to amplify the luminance component of the target scene switching frame to a minimum extent, so that the height value of the amplified target scene switching frame is divisible by the height value of the first watermark, and the width value of the amplified target scene switching frame is divisible by the width value of the first watermark;
the second blocking unit is used for blocking the amplified brightness component of the target scene switching frame to obtain a plurality of blocks; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
And the first extraction unit is used for extracting corresponding bit data of the first re-watermark based on the direct current coefficient of each block and the second quantization step length for each block to obtain the first re-watermark.
In an example embodiment, the first extraction unit is specifically configured to:
the ratio between the direct current coefficient of the block and the second quantization step length is rounded downwards to obtain a seventh numerical value;
surplus is carried out on the seventh numerical value pair 2, and an eighth numerical value is obtained;
in the case that the eighth value is 1, determining the corresponding bit data of the first re-watermark as 1;
in case the eighth value is 0, the corresponding bit data of the first re-watermark is determined to be 0.
In an example embodiment, the fourth extraction module 80 is specifically configured to:
detecting characteristic points of brightness components of the target scene unchanged frames of the third ordinal number in each group of target video frame sequences to obtain a plurality of characteristic points;
screening second characteristic points with characteristic scale sizes within a preset range from the plurality of characteristic points;
constructing an embedded region with a preset size by taking each second characteristic point as a center;
removing the out-of-limit embedded region and the corresponding second feature points;
screening a sixth number of target feature points which are ranked forward from the rest second feature points according to the sequence of the feature point intensities from large to small, and determining the target feature points and the embedding areas corresponding to the neighborhood points thereof as target embedding areas;
Amplifying each target embedded region to the minimum extent so that the height value and the width value of the amplified target embedded region can be divided by a fifth value;
constructing a feature vector of the amplified target embedded region;
and watermark extraction is carried out on the feature vector of the amplified target embedded region based on the target quantization table, so as to obtain a second watermark.
In one example embodiment, the second build module 90 is specifically configured to:
decoding the first re-watermark to obtain a fixed-length character string;
decoding the second watermark to obtain an indefinite length character string;
and constructing the copyright resource identifier based on the fixed-length character string and the indefinite-length character string.
Fig. 7 illustrates a physical schematic diagram of an electronic device, as shown in fig. 7, which may include: processor 810, communication interface (Communications Interface) 820, memory 830, and communication bus 840, wherein processor 810, communication interface 820, memory 830 accomplish communication with each other through communication bus 840. The processor 810 may invoke logic instructions in the memory 830 to execute the dual video watermark embedding method provided in any of the above embodiments, which is not described herein.
Further, the logic instructions in the memory 830 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program storable on a non-transitory computer readable storage medium. The computer program, when executed by the processor, is capable of executing the dual video watermark embedding method provided in any of the above embodiments, and will not be described herein.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having a computer program stored thereon. The computer program is implemented when executed by a processor to perform the dual video watermark embedding method provided in any of the above embodiments, which is not described herein.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (19)

1. A dual video watermark embedding method, comprising:
constructing a first re-watermark and a second re-watermark according to the copyright resource identification;
extracting at least one group of video frame sequences from an original video, wherein the video frame sequences comprise an original scene switching frame and an original scene unchanged frame;
embedding the first re-watermark into the original scene switching frame based on a first quantization step length to obtain a target scene switching frame; the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene change frame and the first watermark embedding strength;
embedding the second watermark into the original scene unchanged frame based on a target quantization table to obtain a target scene unchanged frame; the target quantization table is used for representing any position of the second watermark, under the condition that bit data of the position is 0, the difference value of two adjacent components taking the position as a starting position by 2 times in the feature vector of the target scene unchanged frame is larger than or equal to second watermark embedding strength, and under the condition that bit data of the position is 1, the difference value of two adjacent components taking the position as the starting position by 2 times in the feature vector of the target scene unchanged frame is smaller than or equal to second watermark embedding strength;
And replacing the original scene switching frame in the original video with the target scene switching frame, and replacing the original scene unchanged frame in the original video with the target scene unchanged frame to obtain the target video.
2. The dual video watermark embedding method according to claim 1, wherein said constructing a first watermark and a second watermark according to the copyright resource identification comprises:
splicing all the fixed-length word segments in the copyright resource identifier into a fixed-length character string;
coding the fixed-length character string to obtain a first code;
recombining the first code to obtain a two-dimensional 0/1 matrix serving as the first re-watermark;
splicing all the indefinite length fields in the copyright resource identifier into indefinite length character strings;
dividing the character string with the indefinite length into a plurality of character sub-strings according to bytes;
the character substrings are respectively encoded to obtain a plurality of second codes,
and respectively recombining the plurality of second codes to obtain a plurality of one-dimensional 0/1 vectors serving as the second watermark.
3. The dual video watermark embedding method according to claim 2, wherein said extracting at least one set of video frame sequences from the original video comprises:
Extracting all original scene switching frames from an original video;
for each original scene-cut frame, determining a first ordinal video frame after the original scene-cut frame and a continuous first number of video frames after the first ordinal video frame as the original scene-unchanged frames; the first number is greater than or equal to the number of second encodings;
if the number of frames between two adjacent original scene switching frames is greater than or equal to the sum of the numerical value of the first ordinal number and the numerical value of the first number, the original scene switching frames of the two adjacent original scene switching frames and the corresponding original scene unchanged frames are reserved, otherwise, only the previous original scene switching frame and the corresponding original scene unchanged frames in the two adjacent original scene switching frames are reserved;
and combining each reserved original scene switching frame with each corresponding original scene unchanged frame to obtain a group of video frame sequences.
4. The method of dual video watermark embedding according to claim 2, wherein said embedding the first re-watermark into the original scene-cut frame based on a first quantization step length to obtain a target scene-cut frame comprises:
The brightness component of the original scene-switching frame is amplified to the minimum extent, so that the amplified height value of the original scene-switching frame can be divided by the height value of the first re-watermark, and the amplified width value of the original scene-switching frame can be divided by the width value of the first re-watermark;
partitioning the amplified brightness component of the original scene switching frame to obtain a plurality of partitions; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
for each block, calculating a target direct current coefficient based on the direct current coefficient of the block, the first quantization step size and corresponding bit data in the first re-watermark;
calculating a target pixel value of each pixel of each block based on an original pixel value of the pixel, a difference value between the target direct current coefficient and the direct current coefficient of the block and a width value and a height value of the block to obtain a first scene switching frame;
shrinking the first scene switching frame to obtain the target scene switching frame; the size of the target scene-cut frame is the same as the size of the original scene-cut frame.
5. The dual video watermark embedding method according to claim 4, wherein said calculating a target dc coefficient based on the block dc coefficient, the first quantization step size, and corresponding bit data in the first re-watermark comprises:
rounding the ratio between the direct current coefficient of the block and the first quantization step length to obtain a first numerical value;
taking the sum of the first numerical value and the corresponding bit data in the first reprint to leave 2 to obtain a second numerical value;
multiplying the first value minus 0.5 by the first quantization step under the condition that the second value is 1 to obtain the target direct current coefficient;
and under the condition that the second value is 0, multiplying the first value by the first quantization step length after adding 0.5 to obtain the target direct current coefficient.
6. The dual video watermark embedding method according to claim 4 or 5, wherein said calculating a target pixel value of said pixel based on an original pixel value of said pixel, a difference between said target dc coefficient and a dc coefficient of said block, and a width value and a height value of said block, comprises:
Calculating the difference between the target direct current coefficient and the direct current coefficient of the block to obtain a third numerical value;
calculating the ratio of the third value to the square root of the product between the width value and the height value of the block to obtain a fourth value;
and calculating the sum between the fourth numerical value and the original pixel value of the pixel to obtain the target pixel value of the pixel.
7. A dual video watermark embedding method according to claim 3, wherein said embedding said second watermark into said original scene-invariant frame based on a target quantization table to obtain a target scene-invariant frame comprises:
detecting characteristic points of brightness components of the original scene unchanged frames of the second ordinal number in each group of video frame sequences to obtain a plurality of characteristic points; the value of the second ordinal number is greater than or equal to 1 and less than or equal to the number of the second codes;
screening first characteristic points with characteristic scale sizes within a preset range from the plurality of characteristic points;
constructing an embedded region with a preset size by taking each first characteristic point as a center;
removing the out-of-limit embedded region and the corresponding first characteristic points, screening a second number of target characteristic points which are ranked forward from the rest first characteristic points according to the sequence of the characteristic point intensities from large to small, and determining the embedded region corresponding to the target characteristic points as a target embedded region;
Amplifying the minimum scale of each target embedded region so that the height value and the width value of the amplified target embedded region can be divided by a fifth numerical value; the fifth value is a positive integer and the square of the fifth value is greater than or equal to the product between 8 and a sixth value, the sixth value being the number of bits of the second watermark of the second ordinal number;
constructing a feature vector of each amplified target embedded region;
embedding each bit data of the second watermark of the second ordinal number into the corresponding feature vector based on the target quantization table to obtain a target feature vector;
performing reverse construction on each target feature vector to obtain a first embedded region;
and reducing the first embedded area to the preset size to obtain the target scene unchanged frame.
8. The dual video watermark embedding method according to claim 7, wherein said constructing feature vectors for each of said amplified target embedded regions comprises:
partitioning each amplified target embedded region to obtain a plurality of target embedded region partitions; the number of the target embedded area blocks is the square of the fifth numerical value;
Discrete cosine transform is carried out on each target embedded region block to obtain a direct current coefficient of each target embedded region block, and the direct current coefficients of the target embedded region blocks are arranged into a block direct current coefficient matrix based on the sequence of each target embedded region block in the amplified target embedded region;
performing discrete cosine transform on the block direct current coefficient matrix to obtain a direct current-discrete cosine transform coefficient matrix;
screening a preset number of coefficients from the direct current-discrete cosine transform coefficient matrix to construct the amplified characteristic vector of the target embedded region.
9. The method according to claim 8, wherein the screening a predetermined number of coefficients from the dc-discrete cosine transform coefficient matrix to construct the feature vector of the target embedded region after the amplification, comprises:
extracting a third number of coefficients from the main diagonal of the matrix of dc-discrete cosine transform coefficients; the third number is one-half of the fifth number;
extracting a coefficient at the upper right or lower left of the main diagonal, and extracting a coefficient at the lower left or upper right of the main diagonal, wherein the coefficients are extracted alternately in turn to obtain a fourth number of coefficients; the fourth number has a value that is the difference of one-fourth of the square of the fifth number and one-half of the fifth number;
Combining the extracted coefficients into a feature vector with a length value which is one fourth of the square of the fifth value, and determining a fifth number of coefficients which are ranked later from the feature vector as the feature vector of the amplified target embedded region; the fifth number is twice the sixth number.
10. The dual video watermark embedding method according to claim 9, wherein said performing inverse construction on each of said target feature vectors to obtain a first embedded region comprises:
replacing each coefficient extracted from the direct current-discrete cosine transform coefficient matrix with the target feature vector to obtain a target direct current-discrete cosine transform coefficient matrix;
performing discrete cosine inverse transformation on the target direct current-discrete cosine transformation coefficient matrix to obtain a target block direct current coefficient matrix;
and replacing the direct current coefficients in the target embedded region blocks at corresponding positions with each coefficient in the target block direct current coefficient matrix, performing discrete cosine transform on each replaced target embedded region block, and determining the first embedded region.
11. A dual video watermark extraction method, comprising:
Extracting at least one set of target video frame sequences from the target video; the target video frame sequence comprises a target scene switching frame and a target scene unchanged frame;
watermark extraction is carried out on the target scene switching frame based on a second quantization step length, so that a first re-watermark is obtained; the second quantization step length is the product between the square root of the product between the width value and the height value of the amplified target scene switching frame and the first watermark embedding strength;
watermark extraction is carried out on the unchanged frame of the target scene based on a target quantization table, so that a second watermark is obtained; the target quantization table is used for representing that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is less than 0;
and constructing a copyright resource identifier based on the first re-watermark and the second re-watermark.
12. The dual video watermark extraction method according to claim 11, wherein said watermark extraction of said target scene cut frame based on a second quantization step length to obtain a first re-watermark comprises:
Amplifying the brightness component of the target scene switching frame to the minimum extent so that the height value of the amplified target scene switching frame can be divided by the height value of the first re-watermark, and the width value of the amplified target scene switching frame can be divided by the width value of the first re-watermark;
partitioning the amplified brightness component of the target scene switching frame to obtain a plurality of partitions; the number of the plurality of blocks is the same as the number of bits of the first re-watermark;
and extracting corresponding bit data of the first re-watermark based on the direct current coefficient of each block and the second quantization step length for each block to obtain the first re-watermark.
13. The dual video watermark extraction method according to claim 12, wherein said extracting the corresponding bit data of the first re-watermark based on the block direct current coefficient and the second quantization step size comprises:
the ratio between the direct current coefficient of the block and the second quantization step length is rounded downwards to obtain a seventh numerical value;
taking the remainder of the seventh numerical value pair 2 to obtain an eighth numerical value;
in the case that the eighth value is 1, determining the corresponding bit data of the first re-watermark to be 1;
In case that the eighth value is 0, the corresponding bit data of the first re-watermark is determined to be 0.
14. The dual video watermark extraction method according to claim 11, wherein said watermark extraction of said target scene invariant frame based on a target quantization table, to obtain a second watermark, comprises:
detecting characteristic points of brightness components of the target scene unchanged frames of the third ordinal number in each group of target video frame sequences to obtain a plurality of characteristic points;
screening second characteristic points with characteristic scale sizes within a preset range from the plurality of characteristic points;
constructing an embedded region with a preset size by taking each second characteristic point as a center;
removing the out-of-limit embedded region and the corresponding second feature points;
screening a sixth number of target feature points which are ranked forward from the rest of the second feature points according to the sequence of the feature point intensities from large to small, and determining the embedded areas corresponding to the target feature points and the neighborhood points thereof as target embedded areas;
amplifying each target embedded region to the minimum extent so that the height value and the width value of the amplified target embedded region can be divided by a fifth value;
Constructing the amplified feature vector of the target embedded region;
and extracting the watermark from the amplified feature vector of the target embedded region based on a target quantization table to obtain the second watermark.
15. The dual video watermark extraction method according to claim 11, wherein said constructing a copyright resource identifier based on said first and second re-watermarks comprises:
decoding the first re-watermark to obtain a fixed-length character string;
decoding the second watermark to obtain an indefinite length character string;
and constructing the copyright resource identifier based on the fixed-length character string and the variable-length character string.
16. A dual video watermark embedding apparatus, comprising:
the first construction module is used for constructing a first re-watermark and a second re-watermark according to the copyright resource identification;
the first extraction module is used for extracting at least one group of video frame sequences from the original video, wherein the video frame sequences comprise original scene switching frames and original scene unchanged frames;
the first embedding module is used for embedding the first heavy watermark into the original scene switching frame based on a first quantization step length to obtain a target scene switching frame; the first quantization step length is the product between the square root of the product between the width value and the height value of the amplified original scene change frame and the first watermark embedding strength;
The second embedding module is used for embedding the second watermark into the original scene unchanged frame based on a target quantization table to obtain a target scene unchanged frame; the target quantization table is used for representing any position of the second watermark, the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is larger than or equal to second watermark embedding strength under the condition that the bit data of the position is 0, and the difference value of two adjacent components taking 2 times of the position as the initial position in the feature vector of the target scene unchanged frame is smaller than or equal to second watermark embedding strength under the condition that the bit data of the position is 1;
and the replacing module is used for replacing the original scene switching frame in the original video with the target scene switching frame, and replacing the original scene unchanged frame in the original video with the target scene unchanged frame to obtain the target video.
17. A dual video watermark extraction apparatus, comprising:
a second extraction module for extracting at least one group of target video frame sequences from the target video; the target video frame sequence comprises a target scene switching frame and a target scene unchanged frame;
The third extraction module is used for extracting the watermark from the target scene switching frame based on the second quantization step length to obtain a first re-watermark; the second quantization step length is the product between the square root of the product between the width value and the height value of the amplified target scene switching frame and the first watermark embedding strength;
the fourth extraction module is used for extracting the watermark of the unchanged frame of the target scene based on the target quantization table to obtain a second watermark; the target quantization table is used for representing that the bit data of the corresponding position of the second watermark is 0 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is greater than or equal to 0, and the bit data of the corresponding position of the second watermark is 1 under the condition that the difference value of two adjacent components in the feature vector of the watermark to be extracted of the target scene unchanged frame is less than 0;
and the second construction module is used for constructing the copyright resource identifier based on the first re-watermark and the second re-watermark.
18. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the dual video watermark embedding method as claimed in any one of claims 1 to 10 or the dual video watermark extraction method as claimed in any one of claims 11 to 15 when executing the program.
19. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the dual video watermark embedding method of any one of claims 1 to 10 or the dual video watermark extraction method of any one of claims 11 to 15.
CN202311110524.1A 2023-08-30 2023-08-30 Dual video watermark embedding method, dual video watermark extracting device and electronic equipment Pending CN117156154A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311110524.1A CN117156154A (en) 2023-08-30 2023-08-30 Dual video watermark embedding method, dual video watermark extracting device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311110524.1A CN117156154A (en) 2023-08-30 2023-08-30 Dual video watermark embedding method, dual video watermark extracting device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117156154A true CN117156154A (en) 2023-12-01

Family

ID=88907395

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311110524.1A Pending CN117156154A (en) 2023-08-30 2023-08-30 Dual video watermark embedding method, dual video watermark extracting device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117156154A (en)

Similar Documents

Publication Publication Date Title
Lu et al. Dual-image-based reversible data hiding method using center folding strategy
Lin High capacity reversible data hiding scheme based upon discrete cosine transformation
CN111107370B (en) Video watermark embedding processing method and device, electronic equipment and storage medium
Wang et al. High capacity reversible image watermarking based on integer transform
US11915336B2 (en) Method and device for watermark-based image integrity verification
CN108805788B (en) Reversible watermarking method based on image topological structure
Peng et al. Reversible data hiding based on RSBEMD coding and adaptive multi-segment left and right histogram shifting
Liao et al. Improving the adaptive steganographic methods based on modulus function
CN114037593B (en) Reversible image watermarking algorithm based on reverse histogram translation
CN102760280B (en) High-capacity reversible watermark embedding and extracting method as well as implement system thereof
US8238601B2 (en) System and method for removing digital watermarks from a watermarked image
KR101026081B1 (en) Reversible watermark inserting and original image restoring methods
CN110533569B (en) Watermark processing method based on quadratic difference expansion
CN107682699A (en) A kind of nearly Lossless Image Compression method
CN117156154A (en) Dual video watermark embedding method, dual video watermark extracting device and electronic equipment
CN107292803B (en) Reversible robust digital image watermarking method according with human eye observation rule
Wang et al. High-capacity reversible data hiding based on multi-histogram modification
Mathews et al. Histogram shifting based reversible data hiding using block division and pixel differences
CN115063280A (en) Watermark superposition and recovery method and device
CN110570343B (en) Image watermark embedding method and device based on self-adaptive feature point extraction
CN109389546B (en) Multi-block reversible watermark embedding method and device and watermark extracting method and device
CN112565760A (en) Encoding method, apparatus and storage medium for string encoding technique
Chalamala et al. Local binary patterns for digital image watermarking
Mandal et al. Variant of LSB steganography algorithm for hiding information in RGB images
CN111754378B (en) Image processing method, image processing device, storage medium and electronic device

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