[go: up one dir, main page]

CN114998081B - Video blind watermark embedding and extracting method based on H.265/HEVC - Google Patents

Video blind watermark embedding and extracting method based on H.265/HEVC Download PDF

Info

Publication number
CN114998081B
CN114998081B CN202210562182.6A CN202210562182A CN114998081B CN 114998081 B CN114998081 B CN 114998081B CN 202210562182 A CN202210562182 A CN 202210562182A CN 114998081 B CN114998081 B CN 114998081B
Authority
CN
China
Prior art keywords
watermark
matrix
embedding
video
hevc
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210562182.6A
Other languages
Chinese (zh)
Other versions
CN114998081A (en
Inventor
付冲
贾红展
王钧天
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Northeastern University China
Original Assignee
Northeastern University China
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 Northeastern University China filed Critical Northeastern University China
Priority to CN202210562182.6A priority Critical patent/CN114998081B/en
Publication of CN114998081A publication Critical patent/CN114998081A/en
Application granted granted Critical
Publication of CN114998081B publication Critical patent/CN114998081B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • G06T1/005Robust watermarking, e.g. average attack or collusion attack resistant
    • 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0052Embedding of the watermark in the frequency domain
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0065Extraction of an embedded watermark; Reliable detection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0083Image watermarking whereby only watermarked image required at decoder, e.g. source-based, blind, oblivious

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to a video blind watermark embedding and extracting method based on H.265/HEVC, which comprises the following steps of; encrypting the watermark image with copyright information; the pixel value of the encrypted watermark image is used as watermark information to be embedded into an I frame image and a P frame image of HEVC in a binary form; in the HEVC video decoding stage, watermark information embedded into an I frame image and a P frame image is subjected to blind extraction; the extracted watermark information is decrypted to restore the watermark image, so as to achieve the purpose of copyright protection. The blind watermark embedding and extracting method provided by the invention can effectively limit the increase of the video code rate, realize the blind extraction of the watermark, and ensure the video visual quality while obtaining higher data embedding capacity.

Description

一种基于H.265/HEVC的视频盲水印嵌入和提取方法A video blind watermark embedding and extraction method based on H.265/HEVC

技术领域Technical Field

本发明属于多媒体信息安全技术领域,涉及一种基于H.265/HEVC的视频盲水印嵌入和提取方法。The present invention belongs to the technical field of multimedia information security and relates to a video blind watermark embedding and extraction method based on H.265/HEVC.

背景技术Background Art

视频水印主要是通过将信息嵌入到载体文件中来实现版权保护的目的,其特点包括不可感知性、鲁棒性和高嵌入容量等。视频水印的嵌入点一般选择在空域(像素域)、变换域和压缩域。然而,视频应用一般具有实时性的要求,因为空域和变换域嵌入水印计算复杂度较高,所以大多数算法都选择嵌入在压缩域中。目前,已经有大量的视频水印方案被提出,特别是对于应用最为广泛的视频压缩标准H.264/AVC。Video watermarking is mainly to achieve the purpose of copyright protection by embedding information into the carrier file. Its characteristics include imperceptibility, robustness and high embedding capacity. The embedding points of video watermarks are generally selected in the spatial domain (pixel domain), transform domain and compression domain. However, video applications generally have real-time requirements. Since the computational complexity of embedding watermarks in the spatial domain and transform domain is high, most algorithms choose to embed in the compression domain. At present, a large number of video watermarking schemes have been proposed, especially for the most widely used video compression standard H.264/AVC.

然而,随着人们日益追求更高的视频清晰度体验,H.264/AVC在处理超高分辨率视频时难以提供理想的压缩效率。针对上述问题,新一代视频压缩标准H.265/HEVC由视频编码联合协作小组制定并发布,并速发展的时期,正逐渐成为一个新的热点研究方向。虽然基于H.265/HEVC的水印算法已经取得了一些进展,但仍存在一些不足:However, as people increasingly pursue higher video clarity experience, H.264/AVC is difficult to provide ideal compression efficiency when processing ultra-high resolution videos. In response to the above problems, the new generation of video compression standard H.265/HEVC was developed and released by the Joint Collaboration Group on Video Coding, and is gradually becoming a new hot research direction during its rapid development. Although the watermark algorithm based on H.265/HEVC has made some progress, there are still some shortcomings:

(1)在视频水印中,盲提取是指在视频解码端不需要依赖额外的信息就能成功提取到水印信息。现存基于HEVC的数字水印方案中,大多数需要在数据的嵌入过程中将嵌入位置保存在本地文件中,然后在解码端提取数据时借助于位置图才可以实现水印正确提取。然而,在实际应用场景中,位置图文件如何安全、完整地从发送端传输到接收端是存在困难的,因此这些方案实用性不强。(1) In video watermarking, blind extraction means that the watermark information can be successfully extracted at the video decoding end without relying on additional information. Among the existing digital watermarking schemes based on HEVC, most of them need to save the embedding position in a local file during the data embedding process, and then use the position map to correctly extract the watermark when extracting data at the decoding end. However, in actual application scenarios, it is difficult to transmit the position map file securely and completely from the sender to the receiver, so these schemes are not very practical.

(2)水印算法的不可感知性和嵌入容量没有取得良好的平衡。嵌入水印后的视频不应该影响原有视频的质量,但是随着数据嵌入容量的增大,现存的很多算法会对不可感知性产生较大影响。此外,现有的算法只将水印信息嵌入到视频单一的帧类型中,因此浪费了大量嵌入空间,降低了嵌入效率。(2) There is no good balance between the imperceptibility and embedding capacity of the watermark algorithm. The video embedded with the watermark should not affect the quality of the original video, but as the data embedding capacity increases, many existing algorithms will have a greater impact on imperceptibility. In addition, the existing algorithms only embed the watermark information into a single frame type of the video, thus wasting a lot of embedding space and reducing the embedding efficiency.

发明内容Summary of the invention

为解决上述技术问题,本发明提供一种基于H.265/HEVC的视频盲水印嵌入和提取方法,可以有效限制视频码率的增长,实现水印的盲提取,在取得较高数据嵌入容量的同时保障了视频视觉质量。In order to solve the above technical problems, the present invention provides a video blind watermark embedding and extraction method based on H.265/HEVC, which can effectively limit the growth of video bit rate, realize blind extraction of watermarks, and ensure video visual quality while achieving higher data embedding capacity.

本发明提供一种基于H.265/HEVC的视频盲水印嵌入和提取方法,包括以下步骤:The present invention provides a video blind watermark embedding and extraction method based on H.265/HEVC, comprising the following steps:

步骤1:将带有版权信息的水印图像加密处理;Step 1: Encrypt the watermark image with copyright information;

步骤2:加密后水印图像的像素值作为水印信息以二进制的形式嵌入到HEVC的I帧图像中;Step 2: The pixel values of the encrypted watermark image are embedded into the HEVC I frame image in binary form as watermark information;

步骤3:加密后水印图像的像素值作为水印信息以二进制的形式嵌入到HEVC的P帧图像中;Step 3: The pixel values of the encrypted watermark image are embedded into the HEVC P frame image in binary form as watermark information;

步骤4:HEVC视频解码阶段,对嵌入到I帧图像的水印信息进行盲提取;Step 4: In the HEVC video decoding stage, the watermark information embedded in the I frame image is blindly extracted;

步骤5:HEVC视频解码阶段,对嵌入到P帧图像的水印信息进行盲提取;Step 5: In the HEVC video decoding stage, the watermark information embedded in the P frame image is blindly extracted;

步骤6:将提取出来的水印信息经过解密恢复成水印图像。Step 6: Decrypt the extracted watermark information and restore it to the watermark image.

在本发明的基于H.265/HEVC的视频盲水印嵌入和提取方法中,步骤1具体为;In the video blind watermark embedding and extraction method based on H.265/HEVC of the present invention, step 1 is specifically as follows:

水印图像加密处理使用的加密方法是Fibonacci变换加密算法、Hilbert曲线变换加密算法、仿射变换加密算法或幻方变换加密算法;加密后水印图像的像素值作为水印信息将以二进制的形式嵌入到视频中。The encryption method used in the watermark image encryption processing is the Fibonacci transformation encryption algorithm, the Hilbert curve transformation encryption algorithm, the affine transformation encryption algorithm or the magic square transformation encryption algorithm; the pixel value of the encrypted watermark image will be embedded into the video in binary form as the watermark information.

在本发明的基于H.265/HEVC的视频盲水印嵌入和提取方法中,步骤2具体为;In the video blind watermark embedding and extraction method based on H.265/HEVC of the present invention, step 2 is specifically as follows:

步骤2.1:首先找出I帧的4×4的亮度DST系数块,然后根据亮度DST系数块中第2行和第2列对应系数计算此系数块的PNNZ值,PNNZ值表示指定位置中系数的非零个数;Step 2.1: First, find the 4×4 luminance DST coefficient block of the I frame, and then calculate the PNNZ value of this coefficient block according to the corresponding coefficients in the second row and the second column of the luminance DST coefficient block. The PNNZ value represents the number of non-zero coefficients in the specified position.

步骤2.2:若当前系数块的PNNZ值小于一个预设的阈值Nth,Nth=1~7,则此系数块放弃嵌入水印信息,否则对当前4×4的亮度DST系数块应用反量化和反变换,得到第一重构残差矩阵Rr,如式(1)所示;Step 2.2: If the PNNZ value of the current coefficient block is less than a preset threshold N th , N th =1-7, then the coefficient block abandons embedding watermark information, otherwise the current 4×4 luminance DST coefficient block is dequantized and inversely transformed to obtain the first reconstructed residual matrix R r , as shown in formula (1);

步骤2.3:根据公式(2)计算第一重构残差矩阵Rr中像素点x’33周围8个像素值的平均值 Step 2.3: Calculate the average value of the eight pixel values around the pixel point x'33 in the first reconstructed residual matrix Rr according to formula (2):

步骤2.4:设计水印嵌入矩阵W如式(3)所示:Step 2.4: Design the watermark embedding matrix W as shown in formula (3):

其中,δ为嵌入强度;Where, δ is the embedding strength;

步骤2.5:使用wk代表嵌入水印信息的二进制位,当水印信息的二进制位wk=1时,判断是否成立,Rth>1若成立则此水印信息嵌入完成,执行下一步;否则根据下式设置水印嵌入矩阵W中的嵌入强度:Step 2.5: Use wk to represent the binary bit of the embedded watermark information. When the binary bit of the watermark information wk = 1, determine Is it true? If R th > 1, the watermark information is embedded and the next step is executed; otherwise, the embedding strength in the watermark embedding matrix W is set according to the following formula:

其中,Qstep是等效量化步长;Among them, Qstep is the equivalent quantization step size;

步骤2.6:根据下式利用得到的水印嵌入矩阵W修改原始的DST系数矩阵;Step 2.6: Modify the original DST coefficient matrix using the obtained watermark embedding matrix W according to the following formula;

XW=X+W (5)X W =X+W (5)

其中,X是原始的DST系数矩阵,XW代表修改后的DST系数矩阵,实现了水印的嵌入;Among them, X is the original DST coefficient matrix, X W represents the modified DST coefficient matrix, which realizes the embedding of watermark;

步骤2.7:当水印信息的二进制位wk=0时,判断是否成立,若成立则此水印信息嵌入完成,执行下一步;否则根据下式设置水印嵌入矩阵W中的嵌入强度:Step 2.7: When the binary bit w k of the watermark information is 0, determine Is it true? If so, the watermark information is embedded and the next step is executed; otherwise, the embedding strength in the watermark embedding matrix W is set according to the following formula:

其中,Qstep是等效量化步长;Among them, Qstep is the equivalent quantization step size;

步骤2.8:根据下式利用上一步骤中得到的水印嵌入矩阵W修改原系数矩阵;Step 2.8: Modify the original coefficient matrix using the watermark embedding matrix W obtained in the previous step according to the following formula;

XW=X-W (7) XW =XW (7)

其中,X是原始的DST系数矩阵,XW代表修改后的DST系数矩阵,实现了水印的嵌入。Among them, X is the original DST coefficient matrix, XW represents the modified DST coefficient matrix, which realizes the embedding of watermark.

步骤2.9:当前的4×4的亮度DST系数块处理完毕,重复步骤2.1至2.8,直到所有4×4的亮度DST系数块处理完成。Step 2.9: The current 4×4 luminance DST coefficient block has been processed, and steps 2.1 to 2.8 are repeated until all 4×4 luminance DST coefficient blocks have been processed.

在本发明的基于H.265/HEVC的视频盲水印嵌入和提取方法中,步骤3具体为;In the video blind watermark embedding and extraction method based on H.265/HEVC of the present invention, step 3 is specifically as follows:

步骤3.1:获得每个P帧4×4的亮度DCT系数块,为了实现水印的盲提取,利用DCT系数矩阵A中系数A1和A2作为标志位,若A1和A2的非零数目大于等于一个阈值Tth,Tth取1或2,则进行下一步的嵌入过程,否则该块放弃嵌入数据;Step 3.1: Get the 4×4 luminance DCT coefficient block of each P frame. In order to realize the blind extraction of watermark, use the coefficients A1 and A2 in the DCT coefficient matrix A as flags. If the number of non-zero values of A1 and A2 is greater than or equal to a threshold Tth , Tth is 1 or 2, then proceed to the next step of embedding, otherwise the block abandons the embedded data;

步骤3.2:选用(1,7,3)矩阵编码方案,使用DCT系数矩阵中第3至第9个系数A3~A9作为载波信号,并利用它们的最低有效位构建载波向量S1×7Step 3.2: Select the (1,7,3) matrix coding scheme, use the 3rd to 9th coefficients A 3 ~A 9 in the DCT coefficient matrix as carrier signals, and use their least significant bits to construct the carrier vector S 1×7 :

S1×7=(v1,v2,v3,v4,v5,v6,v7) (9)S 1×7 = (v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 ) (9)

其中,v1~v7分别为A3~A9的最低有效位;Among them, v 1 ~v 7 are the least significant bits of A 3 ~A 9 respectively;

步骤3.3:选取二进制汉明码矩阵H3×7Step 3.3: Select the binary Hamming code matrix H 3×7 :

然后,由H3×7和S1×7根据式(11)计算出依赖向量D3×1Then, the dependency vector D 3×1 is calculated from H 3×7 and S 1×7 according to equation (11);

其中,S1×c代表1行c列载波向量,Hm×c代表m行c列的汉明码矩阵,Dm×1代表m行1列依赖向量,mod代表取模操作;Among them, S 1×c represents a 1-row and c-column carrier vector, H m×c represents an m-row and c-column Hamming code matrix, D m×1 represents an m-row and 1-column dependency vector, and mod represents a modulo operation;

步骤3.4:按顺序选取3bits水印信息组成信息向量E3×1=(m1,m2,m3),然后根据式(12)计算出载波向量S1×7中要修改位置P,根据修改位置对DCT系数矩阵A的A3~A9中相应位置的系数进行加1修改,完成水印嵌入;Step 3.4: Select 3 bits of watermark information in order to form the information vector E 3×1 = (m 1 , m 2 , m 3 ), then calculate the position P to be modified in the carrier vector S 1×7 according to formula (12), and add 1 to the coefficients of the corresponding positions in A 3 to A 9 of the DCT coefficient matrix A according to the modified position to complete the watermark embedding;

其中,bin2dec()表示二进制转十进制函数,代表异或操作;若位置P为零,则代表载波向量不做出改变。Among them, bin2dec() represents the binary to decimal function. represents an XOR operation; if position P is zero, it means that the carrier vector does not change.

步骤3.6:当前的4×4的亮度DCT系数块处理完毕,重复步骤2.2.1至2.2.3,直到所有4×4的亮度DCT系数块处理完成。Step 3.6: The current 4×4 luminance DCT coefficient block is processed, and steps 2.2.1 to 2.2.3 are repeated until all 4×4 luminance DCT coefficient blocks are processed.

在本发明的基于H.265/HEVC的视频盲水印嵌入和提取方法中,步骤4具体为;In the video blind watermark embedding and extraction method based on H.265/HEVC of the present invention, step 4 is specifically as follows:

步骤4.1:在HEVC视频解码端,对于每个I帧的4×4亮度DST系数块,根据亮度DST系数块中第2行和第2列对应系数计算此系数块的PNNZ值,Step 4.1: At the HEVC video decoding end, for each 4×4 luma DST coefficient block of an I frame, calculate the PNNZ value of this coefficient block according to the corresponding coefficients in the second row and the second column of the luma DST coefficient block.

步骤4.2:当此系数块的PNNZ值小于预设阈值Nth时,放弃提取信息;否则,对该系数块应用反量化和反变换,得到第二重构残差矩阵RWStep 4.2: When the PNNZ value of this coefficient block is less than the preset threshold Nth , the information extraction is abandoned; otherwise, the coefficient block is dequantized and inversely transformed to obtain the second reconstructed residual matrix RW :

步骤4.3:计算第二重构残差矩阵RW周围8个像素点的平均值 Step 4.3: Calculate the second reconstruction residual matrix R W The average value of the surrounding 8 pixels

步骤4.4:根据式(14)提取嵌入的水印信息,wk代表提取到的二进制信息位:Step 4.4: Extract the embedded watermark information according to formula (14), wk represents the extracted binary information bit:

步骤4.5:将提取到的水印信息保存起来,重复步骤4.1至4.4,直到所有的4×4的亮度DST系数块处理结束。Step 4.5: Save the extracted watermark information and repeat steps 4.1 to 4.4 until all 4×4 luminance DST coefficient blocks are processed.

在本发明的基于H.265/HEVC的视频盲水印嵌入和提取方法中,步骤5具体为;In the video blind watermark embedding and extraction method based on H.265/HEVC of the present invention, step 5 is specifically as follows:

步骤5.1:在HEVC的视频解码过程中,获得每个P帧4×4的亮度DCT系数块,若修改后的DCT系数矩阵中的系数的非零个数大于等于阈值Tth,则进行下一步提取过程,否则放弃对此块提取水印;Step 5.1: During the HEVC video decoding process, obtain the 4×4 luminance DCT coefficient block of each P frame. If the modified DCT coefficient matrix The coefficients in and If the number of non-zero values of is greater than or equal to the threshold value T th , the next step of extraction is performed, otherwise the watermark extraction for this block is abandoned;

步骤5.2:执行矩阵编码的逆过程,利用修改后的DCT系数矩阵中第3至第9个系数作为载波信号,用的最低有效位构建载波向量S’1×7Step 5.2: Perform the inverse process of matrix encoding, using the modified DCT coefficient matrix The 3rd to 9th coefficients As the carrier signal, The least significant bit of constructs the carrier vector S' 1×7 :

S’1×7=(v’1,v’2,v’3,v’4,v’5,v’6,v’7) (17)S' 1×7 = (v' 1 ,v' 2 ,v' 3 ,v' 4 ,v' 5 ,v' 6 ,v' 7 ) (17)

步骤5.3:利用公式(10)的汉明码矩阵H3×7乘以S’1×7的转置就可以获得提取到的水印信息M3×1Step 5.3: By multiplying the Hamming code matrix H 3×7 in formula (10) by the transpose of S' 1×7 , the extracted watermark information M 3×1 can be obtained:

M3×1=H3×7S’1×7 (18)M 3×1 =H 3×7 S' 1×7 (18)

步骤5.4:将提取到的水印信息保存起来,重复步骤5.1至5.3,直到所有的4×4的亮度DCT系数块的处理结束。Step 5.4: Save the extracted watermark information and repeat steps 5.1 to 5.3 until the processing of all 4×4 luminance DCT coefficient blocks is completed.

在本发明的基于H.265/HEVC的视频盲水印嵌入和提取方法中,还包括通过峰值信噪比PSNR和结构相似指数SSIM对插入水印信息后的视频质量进行评价。The H.265/HEVC-based video blind watermark embedding and extraction method of the present invention also includes evaluating the video quality after the watermark information is inserted through the peak signal-to-noise ratio PSNR and the structural similarity index SSIM.

本发明的一种基于H.265/HEVC的视频盲水印嵌入和提取方法,至少具有以下有益效果:The video blind watermark embedding and extraction method based on H.265/HEVC of the present invention has at least the following beneficial effects:

1、一维信息转换为二维信息提高水印鲁棒性,加密处理提高安全性。一般情况下,表示视频作者版权信息的形式是某行文字或某个特殊编号,当信息以这样的方式嵌入视频中,一旦遭受恶意攻击,信息的可识别性将急剧降低。若信息以图像这种二维形式的嵌入,即使提取的图像像素点发生改变、移位、甚至缺失部分块仍有较大可能辨识出水印信息。1. Converting one-dimensional information into two-dimensional information improves the robustness of the watermark, and encryption processing improves security. Generally, the copyright information of the video author is in the form of a line of text or a special number. When the information is embedded in the video in this way, once it is attacked maliciously, the recognizability of the information will be sharply reduced. If the information is embedded in a two-dimensional form such as an image, even if the extracted image pixels are changed, shifted, or even missing some blocks, it is still possible to identify the watermark information.

2、解码端可以不依赖额外信息成功提取水印信息。本发明利用系数矩阵中部分系数的非零个数判断当前块是否嵌入水印,从而可以在接收端实现真正意义上的水印盲提取,增强了方法的实用性。2. The decoding end can successfully extract the watermark information without relying on additional information. The present invention uses the non-zero number of some coefficients in the coefficient matrix to determine whether the current block is embedded with a watermark, thereby achieving true blind watermark extraction at the receiving end, thereby enhancing the practicability of the method.

3、保证了嵌入水印后视频质量和数据嵌入容量。在视频I帧中,本发明通过分析HEVC的35种帧内预测模式特性,使用了一种无帧内预测误差传播的信息嵌入算法。通过修改4×4大小的亮度DST系数块,最终嵌入效果只可能会引起空域中一个像素点的变化,有效地保证了视频的质量。在视频P帧中,由于P帧大多数是使用帧间预测,因此即使直接修改系数也不会引起帧内预测误差传播,故本发明选择使用矩阵编码的方式增大嵌入容量。3. The video quality and data embedding capacity after watermark embedding are guaranteed. In the video I frame, the present invention uses an information embedding algorithm without intra-frame prediction error propagation by analyzing the characteristics of 35 intra-frame prediction modes of HEVC. By modifying the 4×4 size brightness DST coefficient block, the final embedding effect may only cause a change in one pixel in the spatial domain, which effectively guarantees the quality of the video. In the video P frame, since most P frames use inter-frame prediction, even if the coefficients are directly modified, it will not cause intra-frame prediction error propagation, so the present invention chooses to use matrix coding to increase the embedding capacity.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为本发明的一种基于H.265/HEVC的视频盲水印嵌入和提取方法的流程图;FIG1 is a flow chart of a method for embedding and extracting blind video watermarks based on H.265/HEVC of the present invention;

图2为本实施例中使用带有版权信息的原始水印图像;FIG2 is an original watermark image with copyright information used in this embodiment;

图3为原始水印图像经过加密处理后的图像;Figure 3 is the original watermark image after encryption;

图4为HEVC的I帧中4×4亮度DST系数块水印嵌入流程图;FIG4 is a flowchart of embedding a 4×4 luma DST coefficient block watermark in an I frame of HEVC;

图5为HEVC的I帧中4×4亮度DST系数块的PNNZ值位置计算图;FIG5 is a diagram showing the calculation of the PNNZ value position of a 4×4 luma DST coefficient block in an I frame of HEVC;

图6(a)为测试视频RaceHorses_416x240_30第6帧原始视频帧和水印视频帧对照图;Figure 6(a) is a comparison diagram of the original video frame and the watermarked video frame at the 6th frame of the test video RaceHorses_416x240_30;

图6(b)为测试视频RaceHorses_832x480_30第65帧原始视频帧和水印视频帧对照图;Figure 6(b) is a comparison diagram of the original video frame and the watermarked video frame at frame 65 of the test video RaceHorses_832x480_30;

图6(c)为测试视频FourPeople_1280x720_60第1帧原始视频帧和水印视频帧对照图;Figure 6(c) is a comparison diagram of the original video frame and the watermarked video frame in the first frame of the test video FourPeople_1280x720_60;

图6(d)为测试视频BasketballDrive_1920x1080_50第65帧原始视频帧和水印视频帧对照图。Figure 6(d) is a comparison diagram of the original video frame and the watermarked video frame at frame 65 of the test video BasketballDrive_1920x1080_50.

具体实施方式DETAILED DESCRIPTION

为了更加明确的阐述本发明的目的、技术方法及优点,下面结合附图及具体实施方式对本发明做进一步的详细说明。In order to more clearly explain the purpose, technical methods and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

本发明提出一种基于H.265/HEVC的视频盲水印嵌入和提取方法,通过将信息高效地嵌入到视频压缩域中,为新一代视频压缩标准H.265/HEVC提供一种版权保护解决方案。如图1所示,本发明方法的具体实现包括以下步骤:The present invention proposes a video blind watermark embedding and extraction method based on H.265/HEVC, which provides a copyright protection solution for the new generation video compression standard H.265/HEVC by efficiently embedding information into the video compression domain. As shown in Figure 1, the specific implementation of the method of the present invention includes the following steps:

步骤1:将带有版权信息的水印图像进行加密处理以增强安全性,本实施例中作为水印图像的是64×64大小的灰度图像,如图2所示。水印图像加密后效果如图3所示。具体而言,本步骤中所使用的加密方法可以是Fibonacci变换加密算法、Hilbert曲线变换加密算法、仿射变换加密算法、或幻方变换加密算法等。加密后水印图像的像素值作为水印信息将以二进制的形式嵌入到视频中。Step 1: Encrypt the watermark image with copyright information to enhance security. In this embodiment, the watermark image is a 64×64 grayscale image, as shown in Figure 2. The effect of the encrypted watermark image is shown in Figure 3. Specifically, the encryption method used in this step can be a Fibonacci transformation encryption algorithm, a Hilbert curve transformation encryption algorithm, an affine transformation encryption algorithm, or a magic square transformation encryption algorithm. The pixel value of the encrypted watermark image will be embedded in the video in binary form as the watermark information.

在HEVC的编码阶段,针对I帧和P帧设计了不同的嵌入方法。为了便于描述,将I帧和P帧的方法分开介绍,但是需要注意的是,一般情况下视频的I帧和P帧是交替出现的,即下面描述的嵌入步骤根据帧类型的不同而选择性执行步骤2和步骤3。In the HEVC encoding stage, different embedding methods are designed for I frames and P frames. For ease of description, the methods for I frames and P frames are introduced separately, but it should be noted that in general, I frames and P frames of a video appear alternately, that is, the embedding steps described below selectively execute steps 2 and 3 according to different frame types.

步骤2:加密后水印图像的像素值作为水印信息以二进制的形式嵌入到HEVC的I帧图像中,如图4所示,步骤2具体为;Step 2: The pixel value of the encrypted watermark image is embedded into the HEVC I frame image in binary form as watermark information. As shown in FIG4 , step 2 is specifically as follows;

步骤2.1:首先找出I帧的4×4的亮度DST系数块,然后根据亮度DST系数块中第2行和第2列对应系数,即图5中浅灰色块,计算此系数块的PNNZ值,PNNZ值表示指定位置中系数的非零个数。Step 2.1: First find the 4×4 luminance DST coefficient block of the I frame, and then calculate the PNNZ value of this coefficient block based on the corresponding coefficients in the 2nd row and 2nd column of the luminance DST coefficient block, that is, the light gray block in Figure 5. The PNNZ value represents the number of non-zero coefficients in the specified position.

步骤2.2:若当前系数块的PNNZ小于一个预设的阈值Nth,Nth=1~7,则此系数块放弃嵌入水印信息,否则对当前4×4的亮度DST系数块应用反量化和反变换,得到第一重构残差矩阵Rr,如式(1)所示;Step 2.2: If the PNNZ of the current coefficient block is less than a preset threshold N th , N th =1-7, then the coefficient block abandons embedding watermark information, otherwise the current 4×4 luminance DST coefficient block is dequantized and inversely transformed to obtain the first reconstructed residual matrix R r , as shown in formula (1);

步骤2.3:根据公式(2)计算第一重构残差矩阵Rr中像素点x’33周围8个像素值的平均值 Step 2.3: Calculate the average value of the eight pixel values around the pixel point x'33 in the first reconstructed residual matrix Rr according to formula (2):

步骤2.4:设计水印嵌入矩阵W如式(3)所示:Step 2.4: Design the watermark embedding matrix W as shown in formula (3):

其中,δ为嵌入强度;Where, δ is the embedding strength;

步骤2.5:使用wk代表嵌入水印信息的二进制位,当水印信息的二进制位wk=1时,判断是否成立,Rth>1,若成立则此水印信息嵌入完成,执行下一步;否则根据下式设置水印嵌入矩阵W中的嵌入强度:Step 2.5: Use wk to represent the binary bit of the embedded watermark information. When the binary bit of the watermark information wk = 1, determine Is it true, R th > 1, if it is true, the watermark information is embedded and the next step is executed; otherwise, the embedding strength in the watermark embedding matrix W is set according to the following formula:

其中,Qstep是等效量化步长;Among them, Qstep is the equivalent quantization step size;

步骤2.6:根据下式利用得到的水印嵌入矩阵W修改原始的DST系数矩阵;Step 2.6: Modify the original DST coefficient matrix using the obtained watermark embedding matrix W according to the following formula;

XW=X+W (5)X W =X+W (5)

其中,X是原始的DST系数矩阵,XW代表修改后的DST系数矩阵,实现了水印的嵌入;Among them, X is the original DST coefficient matrix, X W represents the modified DST coefficient matrix, which realizes the embedding of watermark;

步骤2.7:当水印信息的二进制位wk=0时,判断是否成立,若成立则此水印信息嵌入完成,执行下一步;否则根据下式设置水印嵌入矩阵W中的嵌入强度:Step 2.7: When the binary bit w k of the watermark information is 0, determine Is it true? If so, the watermark information is embedded and the next step is executed; otherwise, the embedding strength in the watermark embedding matrix W is set according to the following formula:

其中,Qstep是等效量化步长;Among them, Qstep is the equivalent quantization step size;

步骤2.8:根据下式利用上一步骤中得到的水印嵌入矩阵W修改原系数矩阵;Step 2.8: Modify the original coefficient matrix using the watermark embedding matrix W obtained in the previous step according to the following formula;

XW=X-W (7) XW =XW (7)

其中,X是原始的DST系数矩阵,XW代表修改后的DST系数矩阵,通过对原始系数矩阵的修改,改变了x’33的关系,实现了水印的嵌入。Where X is the original DST coefficient matrix, XW represents the modified DST coefficient matrix. By modifying the original coefficient matrix, x' 33 and The relationship between the two is used to realize the embedding of watermark.

步骤2.9:当前的4×4的亮度DST系数块处理完毕,重复步骤2.1至2.8,直到所有4×4的亮度DST系数块处理完成。Step 2.9: The current 4×4 luminance DST coefficient block has been processed, and steps 2.1 to 2.8 are repeated until all 4×4 luminance DST coefficient blocks have been processed.

步骤2中有两个重要的门限值,Nth和Rth;这两个值的设定是为了平衡数据嵌入算法的不可感知性和嵌入容量,本实施例中分别设置Nth=6和Rth=3。根据嵌入水印信息的二进制位wk的不同取值,设置嵌入矩阵W中的嵌入强度δ,通过嵌入矩阵W修改原始的DST系数矩阵,以实现水印信息的嵌入。There are two important threshold values in step 2, Nth and Rth ; these two values are set to balance the imperceptibility and embedding capacity of the data embedding algorithm. In this embodiment, Nth = 6 and Rth = 3 are set respectively. According to the different values of the binary bit wk of the embedded watermark information, the embedding strength δ in the embedding matrix W is set, and the original DST coefficient matrix is modified by the embedding matrix W to achieve the embedding of watermark information.

步骤3:加密后水印图像的像素值作为水印信息以二进制的形式嵌入到HEVC的P帧图像中,步骤3具体为;Step 3: The pixel value of the encrypted watermark image is embedded into the HEVC P frame image in binary form as watermark information. Step 3 is specifically as follows;

步骤3.1:获得每个P帧4×4的亮度DCT系数块,为了实现水印的盲提取,利用DCT系数矩阵A中系数A1和A2作为标志位,若A1和A2的非零数目大于等于一个阈值Tth,Tth取1或2,则进行下一步的嵌入过程,否则该块放弃嵌入数据;Step 3.1: Get the 4×4 luminance DCT coefficient block of each P frame. In order to realize the blind extraction of watermark, use the coefficients A1 and A2 in the DCT coefficient matrix A as flags. If the number of non-zero values of A1 and A2 is greater than or equal to a threshold Tth , Tth is 1 or 2, then proceed to the next step of embedding, otherwise the block abandons the embedded data;

步骤3.2:选用(1,7,3)矩阵编码方案,使用DCT系数矩阵中第3至第9个系数A3~A9作为载波信号,并利用它们的最低有效位构建载波向量S1×7Step 3.2: Select the (1,7,3) matrix coding scheme, use the 3rd to 9th coefficients A 3 ~A 9 in the DCT coefficient matrix as carrier signals, and use their least significant bits to construct the carrier vector S 1×7 :

S1×7=(v1,v2,v3,v4,v5,v6,v7) (9)S 1×7 = (v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 ) (9)

其中,v1~v7分别为A3~A9的最低有效位;Among them, v 1 ~v 7 are the least significant bits of A 3 ~A 9 respectively;

步骤3.3:选取二进制汉明码矩阵H3×7Step 3.3: Select the binary Hamming code matrix H 3×7 :

然后,由H3×7和S1×7根据式(11)计算出依赖向量D3×1Then, the dependency vector D 3×1 is calculated from H 3×7 and S 1×7 according to equation (11);

其中,S1×c代表1行c列载波向量,Hm×c代表m行c列的汉明码矩阵,Dm×1代表m行1列依赖向量,mod代表取模操作;Among them, S 1×c represents a 1-row and c-column carrier vector, H m×c represents an m-row and c-column Hamming code matrix, D m×1 represents an m-row and 1-column dependency vector, and mod represents a modulo operation;

步骤3.4:按顺序选取3bits水印信息组成信息向量E3×1=(m1,m2,m3),然后根据式(12)计算出载波向量S1×7中要修改位置P,根据修改位置对DCT系数矩阵A的A3~A9中相应位置的系数进行加1修改,完成水印嵌入;Step 3.4: Select 3 bits of watermark information in order to form the information vector E 3×1 = (m 1 , m 2 , m 3 ), then calculate the position P to be modified in the carrier vector S 1×7 according to formula (12), and add 1 to the coefficients of the corresponding positions in A 3 to A 9 of the DCT coefficient matrix A according to the modified position to complete the watermark embedding;

其中,bin2dec()表示二进制转十进制函数,代表异或操作;若位置P为零,则代表载波向量不做出改变。Among them, bin2dec() represents the binary to decimal function. represents an XOR operation; if position P is zero, it means that the carrier vector does not change.

步骤3.6:当前的4×4的亮度DCT系数块处理完毕,重复步骤2.2.1至2.2.3,直到所有4×4的亮度DCT系数块处理完成。Step 3.6: The current 4×4 luminance DCT coefficient block is processed, and steps 2.2.1 to 2.2.3 are repeated until all 4×4 luminance DCT coefficient blocks are processed.

步骤4:HEVC视频解码阶段,对嵌入到I帧图像的水印信息进行盲提取,步骤4具体为;Step 4: In the HEVC video decoding stage, the watermark information embedded in the I frame image is blindly extracted. Step 4 is as follows:

步骤4.1:在HEVC视频解码端,对于每个I帧的4×4亮度DST系数块,根据亮度DST系数块中第2行和第2列对应系数计算此系数块的PNNZ值,Step 4.1: At the HEVC video decoding end, for each 4×4 luma DST coefficient block of an I frame, calculate the PNNZ value of this coefficient block according to the corresponding coefficients in the second row and the second column of the luma DST coefficient block.

步骤4.2:当此系数块的PNNZ值小于预设阈值Nth时,放弃提取信息;否则,对该系数块应用反量化和反变换,得到第二重构残差矩阵RWStep 4.2: When the PNNZ value of this coefficient block is less than the preset threshold Nth , the information extraction is abandoned; otherwise, the coefficient block is dequantized and inversely transformed to obtain the second reconstructed residual matrix RW :

步骤4.3:计算第二重构残差矩阵RW周围8个像素点的平均值xWStep 4.3: Calculate the second reconstruction residual matrix R W The average value of the surrounding 8 pixels x W ;

步骤4.4:根据式(14)提取嵌入的水印信息,wk代表提取到的二进制信息位:Step 4.4: Extract the embedded watermark information according to formula (14), wk represents the extracted binary information bit:

步骤4.5:将提取到的水印信息保存起来,重复步骤4.1至4.4,直到所有的4×4的亮度DST系数块处理结束。Step 4.5: Save the extracted watermark information and repeat steps 4.1 to 4.4 until all 4×4 luminance DST coefficient blocks are processed.

步骤5:HEVC视频解码阶段,对嵌入到P帧图像的水印信息进行盲提取,步骤5具体为;Step 5: In the HEVC video decoding stage, the watermark information embedded in the P frame image is blindly extracted. Step 5 is as follows:

步骤5.1:在HEVC的视频解码过程中,获得每个P帧4×4的亮度DCT系数块,若修改后的DCT系数矩阵中的系数的非零个数大于等于阈值Tth,则进行下一步提取过程,否则放弃对此块提取水印;Step 5.1: During the HEVC video decoding process, obtain the 4×4 luminance DCT coefficient block of each P frame. If the modified DCT coefficient matrix The coefficients in and If the number of non-zero values of is greater than or equal to the threshold value T th , the next step of extraction is performed, otherwise the watermark extraction for this block is abandoned;

步骤5.2:执行矩阵编码的逆过程,利用修改后的DCT系数矩阵中第3至第9个系数作为载波信号,用的最低有效位构建载波向量S’1×7Step 5.2: Perform the inverse process of matrix encoding, using the modified DCT coefficient matrix The 3rd to 9th coefficients As the carrier signal, The least significant bit of constructs the carrier vector S' 1×7 :

S’1×7=(v’1,v’2,v’3,v’4,v’5,v’6,v’7) (17)S' 1×7 = (v' 1 ,v' 2 ,v' 3 ,v' 4 ,v' 5 ,v' 6 ,v' 7 ) (17)

步骤5.3:利用公式(10)的汉明码矩阵H3×7乘以S’1×7的转置就可以获得提取到的水印信息M3×1Step 5.3: By multiplying the Hamming code matrix H 3×7 in formula (10) by the transpose of S' 1×7 , the extracted watermark information M 3×1 can be obtained:

M3×1=H3×7S’T 1×7 (18)M 3×1 =H 3×7 S' T 1×7 (18)

步骤5.4:将提取到的水印信息保存起来,重复步骤5.1至5.3,直到所有的4×4的亮度DCT系数块的处理结束。Step 5.4: Save the extracted watermark information and repeat steps 5.1 to 5.3 until the processing of all 4×4 luminance DCT coefficient blocks is completed.

步骤6:将提取的水印信息通过解密恢复为水印图像,完成水印图像的提取。Step 6: The extracted watermark information is restored to the watermark image through decryption to complete the extraction of the watermark image.

实验结果与分析Experimental results and analysis

1、视频码率增长分析1. Video bitrate growth analysis

一般情况下,视频中嵌入数据必然会带来一定程度的码率膨胀。但是嵌入算法不应该显著地影响视频的编解码过程,降低用户的使用体验。本发明通过对多种视频序列进行实验,测试该水印方法对视频码率的影响,实验结果如表1所示。在表1中,视频序列名称的构成如下:以RaceHorses_416x240_30为例,RaceHorses代表序列名称,416×240代表视频分辨率,30代表视频的帧率(frame rate)。QP代表视频压缩时的量化参数。码率的基本单位为kbps,从实验结果可以看出,所有测试序列的平均码率膨胀仅有0.2033%,可见本发明提出的水印方法对视频码率的膨胀影响较小。In general, embedding data in a video will inevitably lead to a certain degree of bit rate expansion. However, the embedding algorithm should not significantly affect the encoding and decoding process of the video and reduce the user experience. The present invention tests the influence of the watermarking method on the video bit rate by conducting experiments on a variety of video sequences. The experimental results are shown in Table 1. In Table 1, the composition of the video sequence name is as follows: Taking RaceHorses_416x240_30 as an example, RaceHorses represents the sequence name, 416×240 represents the video resolution, and 30 represents the frame rate of the video. QP represents the quantization parameter during video compression. The basic unit of the bit rate is kbps. It can be seen from the experimental results that the average bit rate expansion of all test sequences is only 0.2033%. It can be seen that the watermarking method proposed in the present invention has little effect on the expansion of the video bit rate.

表1水印引入的视频码率膨胀Table 1 Video bit rate expansion introduced by watermark

2、视频主观质量分析2. Video Subjective Quality Analysis

主观质量主要是指视频嵌入水印后,人类视觉是否能察觉到水印的存在。图6(a)-图6(d)是测试序列原始和嵌入水印视频帧对比图。图中,左侧是原始视频压缩后解码的视频帧,右侧是加入水印后压缩并解码的视频帧。主观质量分析实验结果均是在QP=28的情况下得到的。图6(a)为测试视频RaceHorses_416x240_30第6帧原始视频帧和水印视频帧对照图,图6(b)为测试视频RaceHorses_832x480_30第65帧原始视频帧和水印视频帧对照图,图6(c)为测试视频FourPeople_1280x720_60第1帧原始视频帧和水印视频帧对照图,图6(d)为测试视频BasketballDrive_1920x1080_50第65帧原始视频帧和水印视频帧对照图。实验结果表明,人眼很难察觉到视频中水印的存在,本水印方法未对视频主观质量造成明显的影响,保证了水印算法的不可感知性。Subjective quality mainly refers to whether human vision can detect the presence of watermarks after watermarks are embedded in the video. Figure 6 (a)-Figure 6 (d) are comparisons of the original and watermarked video frames of the test sequence. In the figure, the left side is the video frame decoded after the original video is compressed, and the right side is the video frame compressed and decoded after the watermark is added. The subjective quality analysis experimental results are all obtained under the condition of QP = 28. Figure 6 (a) is a comparison of the original video frame and the watermarked video frame of the 6th frame of the test video RaceHorses_416x240_30, Figure 6 (b) is a comparison of the original video frame and the watermarked video frame of the 65th frame of the test video RaceHorses_832x480_30, Figure 6 (c) is a comparison of the original video frame and the watermarked video frame of the 1st frame of the test video FourPeople_1280x720_60, and Figure 6 (d) is a comparison of the original video frame and the watermarked video frame of the 65th frame of the test video BasketballDrive_1920x1080_50. The experimental results show that it is difficult for the human eye to perceive the presence of watermarks in videos. This watermarking method does not have a significant impact on the subjective quality of the video, ensuring the imperceptibility of the watermarking algorithm.

3、视频客观质量分析3. Objective video quality analysis

在视频的主观质量评价体系中往往需要大量的人力和时间成本,并且会受到测试者主观意识的影响,而客观质量评价体系则是利用算法和视觉模型,在计算机上完成对重建图像的质量评估。下面利用多个客观评价指标,从多个维度分析水印算法对视频质量的影响。The subjective quality evaluation system of the video often requires a lot of manpower and time costs, and will be affected by the subjective consciousness of the tester, while the objective quality evaluation system uses algorithms and visual models to complete the quality evaluation of the reconstructed image on the computer. The following uses multiple objective evaluation indicators to analyze the impact of the watermark algorithm on video quality from multiple dimensions.

(1)PSNR(1) PSNR

峰值信噪比PSNR(Peak Signal to Noise Ratio)是一种经典的全参考图像度量标准,用于衡量原始图像与失真图像之间的差异。PSNR定义如式(19)所示:Peak Signal to Noise Ratio (PSNR) is a classic full-reference image metric used to measure the difference between the original image and the distorted image. The PSNR definition is shown in formula (19):

在式(19)中,MaxErr是对应图像颜色分量最大值的绝对值(在本中设置为1),MSE是均方根误差,其定义如式(20)所示:In formula (19), MaxErr is the absolute value of the maximum value of the corresponding image color component (in this case is set to 1), MSE is the root mean square error, which is defined as shown in formula (20):

在式(20)中,m和n分别对应图像的长度和宽度,I(i,j)和K(i,j)分别对应原始图像和失真图像。在本实验中,PSNR的取值范围为0到100,值越大代表视频图像的失真越小,当取值在30~40之间时,图像产生的失真便很难被察觉。表2中给出了本水印算法对视频PSNR值的影响。其中,PSNR值的计算结果是视频序列在YUV分量上的平均值。参考图像是压缩前的视频图像,原始视频是未嵌入水印时经HEVC压缩并解码后的视频。由表2中可以看出,本发明算法的PSNR值相比于原始视频只有微小的减少。实验结果表明,本发明的视频水印算法具有良好的不可感知性。In formula (20), m and n correspond to the length and width of the image, respectively, and I(i, j) and K(i, j) correspond to the original image and the distorted image, respectively. In this experiment, the value range of PSNR is 0 to 100. The larger the value, the smaller the distortion of the video image. When the value is between 30 and 40, the distortion of the image is difficult to be detected. Table 2 shows the impact of the watermark algorithm on the PSNR value of the video. Among them, the calculation result of the PSNR value is the average value of the video sequence on the YUV component. The reference image is the video image before compression, and the original video is the video compressed and decoded by HEVC when the watermark is not embedded. It can be seen from Table 2 that the PSNR value of the algorithm of the present invention is only slightly reduced compared with the original video. The experimental results show that the video watermark algorithm of the present invention has good imperceptibility.

表2本发明的水印算法对视频PSNR值的影响Table 2 The influence of the watermark algorithm of the present invention on the video PSNR value

(2)SSIM(2)SSIM

结构相似指数SSIM(Structure Similarity)是从亮度相似度、对比相似度和结构相似度三个分量来评估图像失真。该算法利用一个窗口函数Wi,j(i,j=0,1,2,…,N)在图像上执行卷积得到,定义如式(21)所示:The structural similarity index SSIM (Structure Similarity) evaluates image distortion from three components: brightness similarity, contrast similarity, and structural similarity. The algorithm uses a window function W i,j (i,j = 0, 1, 2, ..., N) to perform convolution on the image, and is defined as shown in formula (21):

需要的注意是,在式(21)中,图像U用到了负索引,其超出了图像区域,这里将最近的边缘像素扩展到所需位置。然后,利用式(22)中的卷积操作,在式(23)中计算图像像素的SSIM:It should be noted that in equation (21), the image U uses negative indices that extend beyond the image area, and here the nearest edge pixels are extended to the desired position. Then, using the convolution operation in equation (22), the SSIM of the image pixels is calculated in equation (23):

在式(23)中,C1=0.012,C2=0.032。SSIM取值范围是0到1,值越大代表图像失真越小,SSIM=1说明两个图像相同。表3是实验中本水印算法对视频图像SSIM值的影响。从表3中的实验结果可以看出,本发明的水印算法对SSIM值的影响很小,说明水印对视频图像仅造成了轻微失真。In formula (23), C 1 = 0.01 2 , C 2 = 0.03 2 . The SSIM value range is from 0 to 1. The larger the value, the smaller the image distortion. SSIM = 1 means that the two images are the same. Table 3 shows the influence of the watermark algorithm on the SSIM value of the video image in the experiment. From the experimental results in Table 3, it can be seen that the watermark algorithm of the present invention has little influence on the SSIM value, indicating that the watermark only causes slight distortion to the video image.

表3本发明水印算法对视频SSIM值的影响Table 3 The impact of the watermark algorithm of the present invention on the video SSIM value

本实验用于测试的平台为:Intel(R)Core(TM)i5-10400 CPU@2.90GHz;内存(RAM):16GB;操作系统:Windows 10 64位;算法实现语言:C++语言。The platform used for testing in this experiment is: Intel(R) Core(TM) i5-10400 CPU@2.90GHz; memory (RAM): 16GB; operating system: Windows 10 64-bit; algorithm implementation language: C++ language.

通过以上的一系列分析说明本发明提出的基于H.265/HEVC盲水印方法,可以有效限制视频码率的增长,实现水印的盲提取,在取得较高数据嵌入容量的同时保障了视频视觉质量。实验证明本发明的水印方法适用于视频版权保护等应用场景,具有较高的实用价值。The above series of analyses show that the blind watermarking method based on H.265/HEVC proposed in the present invention can effectively limit the growth of video bit rate, realize blind extraction of watermarks, and ensure video visual quality while achieving higher data embedding capacity. Experiments have proved that the watermarking method of the present invention is suitable for application scenarios such as video copyright protection and has high practical value.

以上所述仅为本发明的较佳实施例,并不用以限制本发明的思想,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above description is only a preferred embodiment of the present invention and is not intended to limit the concept of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (3)

1.一种基于H.265/HEVC的视频盲水印嵌入和提取方法,其特征在于,包括以下步骤:1. A video blind watermark embedding and extraction method based on H.265/HEVC, characterized in that it comprises the following steps: 步骤1:将带有版权信息的水印图像加密处理;Step 1: Encrypt the watermark image with copyright information; 步骤2:加密后水印图像的像素值作为水印信息以二进制的形式嵌入到HEVC的I帧图像中;Step 2: The pixel values of the encrypted watermark image are embedded into the HEVC I frame image in binary form as watermark information; 步骤3:加密后水印图像的像素值作为水印信息以二进制的形式嵌入到HEVC的P帧图像中;Step 3: The pixel values of the encrypted watermark image are embedded into the HEVC P frame image in binary form as watermark information; 步骤4:HEVC视频解码阶段,对嵌入到I帧图像的水印信息进行盲提取;Step 4: In the HEVC video decoding stage, the watermark information embedded in the I frame image is blindly extracted; 步骤5:HEVC视频解码阶段,对嵌入到P帧图像的水印信息进行盲提取;Step 5: In the HEVC video decoding stage, the watermark information embedded in the P frame image is blindly extracted; 步骤6:将提取出来的水印信息经过解密恢复成水印图像;Step 6: Decrypt the extracted watermark information and restore it to the watermark image; 步骤2具体为;Step 2 is specifically as follows: 步骤2.1:首先找出I帧的4×4的亮度DST系数块,然后根据亮度DST系数块中第2行和第2列对应系数计算此系数块的PNNZ值,PNNZ值表示指定位置中系数的非零个数;Step 2.1: First, find the 4×4 luminance DST coefficient block of the I frame, and then calculate the PNNZ value of this coefficient block according to the corresponding coefficients in the second row and the second column of the luminance DST coefficient block. The PNNZ value represents the number of non-zero coefficients in the specified position. 步骤2.2:若当前系数块的PNNZ值小于一个预设的阈值Nth,Nth=1~7,则此系数块放弃嵌入水印信息,否则对当前4×4的亮度DST系数块应用反量化和反变换,得到第一重构残差矩阵Rr,如式(1)所示;Step 2.2: If the PNNZ value of the current coefficient block is less than a preset threshold N th , N th =1-7, then the coefficient block abandons embedding watermark information, otherwise the current 4×4 luminance DST coefficient block is dequantized and inversely transformed to obtain the first reconstructed residual matrix R r , as shown in formula (1); 步骤2.3:根据公式(2)计算第一重构残差矩阵Rr中像素点x'33周围8个像素值的平均值 Step 2.3: Calculate the average value of the eight pixel values around the pixel point x'33 in the first reconstructed residual matrix Rr according to formula (2): 步骤2.4:设计水印嵌入矩阵W如式(3)所示:Step 2.4: Design the watermark embedding matrix W as shown in formula (3): 其中,δ为嵌入强度;Where, δ is the embedding strength; 步骤2.5:使用wk代表嵌入水印信息的二进制位,当水印信息的二进制位wk=1时,判断是否成立,Rth>1,若成立则此水印信息嵌入完成,执行下一步;否则根据下式设置水印嵌入矩阵W中的嵌入强度:Step 2.5: Use wk to represent the binary bit of the embedded watermark information. When the binary bit of the watermark information wk = 1, determine Is it true, R th > 1, if it is true, the watermark information is embedded and the next step is executed; otherwise, the embedding strength in the watermark embedding matrix W is set according to the following formula: 其中,Qstep是等效量化步长;Among them, Qstep is the equivalent quantization step size; 步骤2.6:根据下式利用得到的水印嵌入矩阵W修改原始的DST系数矩阵;Step 2.6: Modify the original DST coefficient matrix using the obtained watermark embedding matrix W according to the following formula; XW=X+W (5)X W =X+W (5) 其中,X是原始的DST系数矩阵,XW代表修改后的DST系数矩阵,实现了水印的嵌入;Among them, X is the original DST coefficient matrix, X W represents the modified DST coefficient matrix, which realizes the embedding of watermark; 步骤2.7:当水印信息的二进制位wk=0时,判断是否成立,若成立则此水印信息嵌入完成,执行下一步;否则根据下式设置水印嵌入矩阵W中的嵌入强度:Step 2.7: When the binary bit w k of the watermark information is 0, determine Is it true? If so, the watermark information is embedded and the next step is executed; otherwise, the embedding strength in the watermark embedding matrix W is set according to the following formula: 其中,Qstep是等效量化步长;Among them, Qstep is the equivalent quantization step size; 步骤2.8:根据下式利用上一步骤中得到的水印嵌入矩阵W修改原系数矩阵;Step 2.8: Modify the original coefficient matrix using the watermark embedding matrix W obtained in the previous step according to the following formula; XW=X-W (7) XW =XW (7) 其中,X是原始的DST系数矩阵,XW代表修改后的DST系数矩阵,实现了水印的嵌入;Among them, X is the original DST coefficient matrix, X W represents the modified DST coefficient matrix, which realizes the embedding of watermark; 步骤2.9:当前的4×4的亮度DST系数块处理完毕,重复步骤2.1至2.8,直到所有4×4的亮度DST系数块处理完成;Step 2.9: The current 4×4 luminance DST coefficient block is processed, and steps 2.1 to 2.8 are repeated until all 4×4 luminance DST coefficient blocks are processed; 步骤3具体为;Step 3 is specifically as follows: 步骤3.1:获得每个P帧4×4的亮度DCT系数块,为了实现水印的盲提取,利用DCT系数矩阵A中系数A1和A2作为标志位,若A1和A2的非零数目大于等于一个阈值Tth,Tth取1或2,则进行下一步的嵌入过程,否则该块放弃嵌入数据;Step 3.1: Get the 4×4 luminance DCT coefficient block of each P frame. In order to realize the blind extraction of watermark, use the coefficients A1 and A2 in the DCT coefficient matrix A as flags. If the number of non-zero values of A1 and A2 is greater than or equal to a threshold Tth , Tth is 1 or 2, then proceed to the next step of embedding, otherwise the block abandons the embedded data; 步骤3.2:选用(1,7,3)矩阵编码方案,使用DCT系数矩阵中第3至第9个系数A3~A9作为载波信号,并利用它们的最低有效位构建载波向量S1×7Step 3.2: Select the (1,7,3) matrix coding scheme, use the 3rd to 9th coefficients A 3 ~A 9 in the DCT coefficient matrix as carrier signals, and use their least significant bits to construct the carrier vector S 1×7 : S1×7=(v1,v2,v3,v4,v5,v6,v7) (9)S 1×7 = (v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 ) (9) 其中,v1:v7分别为A3~A9的最低有效位;Among them, v 1 :v 7 are the least significant bits of A 3 to A 9 respectively; 步骤3.3:选取二进制汉明码矩阵H3×7Step 3.3: Select the binary Hamming code matrix H 3×7 : 然后,由H3×7和S1×7根据式(11)计算出依赖向量D3×1Then, the dependency vector D 3×1 is calculated from H 3×7 and S 1×7 according to equation (11); 其中,S1×c代表1行c列载波向量,Hm×c代表m行c列的汉明码矩阵,Dm×1代表m行1列依赖向量,mod代表取模操作;Among them, S 1×c represents a 1-row and c-column carrier vector, H m×c represents an m-row and c-column Hamming code matrix, D m×1 represents an m-row and 1-column dependency vector, and mod represents a modulo operation; 步骤3.4:按顺序选取3bits水印信息组成信息向量E3×1=(m1,m2,m3),然后根据式(12)计算出载波向量S1×7中要修改位置P,根据修改位置对DCT系数矩阵A的A3~A9中相应位置的系数进行加1修改,完成水印嵌入;Step 3.4: Select 3 bits of watermark information in order to form the information vector E 3×1 = (m 1 , m 2 , m 3 ), then calculate the position P to be modified in the carrier vector S 1×7 according to formula (12), and add 1 to the coefficients of the corresponding positions in A 3 to A 9 of the DCT coefficient matrix A according to the modified position to complete the watermark embedding; 其中,bin2dec()表示二进制转十进制函数,代表异或操作;若位置P为零,则代表载波向量不做出改变;Among them, bin2dec() represents the binary to decimal function. represents an XOR operation; if position P is zero, it means that the carrier vector does not change; 步骤3.5:当前的4×4的亮度DCT系数块处理完毕,重复步骤3.1至3.4,直到所有4×4的亮度DCT系数块处理完成;Step 3.5: The current 4×4 luminance DCT coefficient block is processed, and steps 3.1 to 3.4 are repeated until all 4×4 luminance DCT coefficient blocks are processed; 步骤4具体为;Step 4 is specifically as follows; 步骤4.1:在HEVC视频解码端,对于每个I帧的4×4亮度DST系数块,根据亮度DST系数块中第2行和第2列对应系数计算此系数块的PNNZ值;Step 4.1: At the HEVC video decoding end, for each 4×4 luma DST coefficient block of an I frame, calculate the PNNZ value of this coefficient block according to the corresponding coefficients in the second row and the second column of the luma DST coefficient block; 步骤4.2:当此系数块的PNNZ值小于预设阈值Nth时,放弃提取信息;否则,对该系数块应用反量化和反变换,得到第二重构残差矩阵RWStep 4.2: When the PNNZ value of this coefficient block is less than the preset threshold Nth , the information extraction is abandoned; otherwise, the coefficient block is dequantized and inversely transformed to obtain the second reconstructed residual matrix RW : 步骤4.3:计算第二重构残差矩阵RW周围8个像素点的平均值 Step 4.3: Calculate the second reconstruction residual matrix R W The average value of the surrounding 8 pixels 步骤4.4:根据式(14)提取嵌入的水印信息,wk代表提取到的二进制信息位:Step 4.4: Extract the embedded watermark information according to formula (14), wk represents the extracted binary information bit: 步骤4.5:将提取到的水印信息保存起来,重复步骤4.1至4.4,直到所有的4×4的亮度DST系数块处理结束;Step 4.5: Save the extracted watermark information and repeat steps 4.1 to 4.4 until all 4×4 luminance DST coefficient blocks are processed; 步骤5具体为;Step 5 is specifically as follows; 步骤5.1:在HEVC的视频解码过程中,获得每个P帧4×4的亮度DCT系数块,若修改后的DCT系数矩阵中的系数的非零个数大于等于阈值Tth,则进行下一步提取过程,否则放弃对此块提取水印;Step 5.1: During the HEVC video decoding process, obtain the 4×4 luminance DCT coefficient block of each P frame. If the modified DCT coefficient matrix The coefficients in and If the number of non-zero values of is greater than or equal to the threshold value T th , the next step of extraction is performed, otherwise the watermark extraction for this block is abandoned; 步骤5.2:执行矩阵编码的逆过程,利用修改后的DCT系数矩阵A中第3至第9个系数作为载波信号,用的最低有效位构建载波向量S'1×7Step 5.2: Perform the inverse process of matrix coding, using the 3rd to 9th coefficients in the modified DCT coefficient matrix A As the carrier signal, The least significant bit of constructs the carrier vector S' 1×7 : 步骤5.3:利用公式(10)的汉明码矩阵H3×7乘以S'1×7的转置就可以获得提取到的水印信息M3×1Step 5.3: By multiplying the Hamming code matrix H 3×7 in formula (10) by the transpose of S' 1×7 , the extracted watermark information M 3×1 can be obtained: M3×1=H3×7S'1×7 (18)M 3×1 =H 3×7 S' 1×7 (18) 步骤5.4:将提取到的水印信息保存起来,重复步骤5.1至5.3,直到所有的4×4的亮度DCT系数块的处理结束。Step 5.4: Save the extracted watermark information and repeat steps 5.1 to 5.3 until the processing of all 4×4 luminance DCT coefficient blocks is completed. 2.如权利要求1所述的基于H.265/HEVC的视频盲水印嵌入和提取方法,其特征在于,步骤1具体为;2. The method for embedding and extracting blind video watermarks based on H.265/HEVC according to claim 1, wherein step 1 specifically comprises: 水印图像加密处理使用的加密方法是Fibonacci变换加密算法、Hilbert曲线变换加密算法、仿射变换加密算法或幻方变换加密算法;加密后水印图像的像素值作为水印信息将以二进制的形式嵌入到视频中。The encryption method used in the watermark image encryption processing is the Fibonacci transformation encryption algorithm, the Hilbert curve transformation encryption algorithm, the affine transformation encryption algorithm or the magic square transformation encryption algorithm; the pixel value of the encrypted watermark image will be embedded into the video in binary form as the watermark information. 3.如权利要求1所述的基于H.265/HEVC的视频盲水印嵌入和提取方法,其特征在于,还包括通过峰值信噪比PSNR和结构相似指数SSIM对插入水印信息后的视频质量进行评价。3. The video blind watermark embedding and extraction method based on H.265/HEVC as described in claim 1 is characterized in that it also includes evaluating the video quality after the watermark information is inserted through the peak signal-to-noise ratio PSNR and the structural similarity index SSIM.
CN202210562182.6A 2022-05-23 2022-05-23 Video blind watermark embedding and extracting method based on H.265/HEVC Active CN114998081B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210562182.6A CN114998081B (en) 2022-05-23 2022-05-23 Video blind watermark embedding and extracting method based on H.265/HEVC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210562182.6A CN114998081B (en) 2022-05-23 2022-05-23 Video blind watermark embedding and extracting method based on H.265/HEVC

Publications (2)

Publication Number Publication Date
CN114998081A CN114998081A (en) 2022-09-02
CN114998081B true CN114998081B (en) 2024-08-23

Family

ID=83026501

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210562182.6A Active CN114998081B (en) 2022-05-23 2022-05-23 Video blind watermark embedding and extracting method based on H.265/HEVC

Country Status (1)

Country Link
CN (1) CN114998081B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101540898A (en) * 2009-04-24 2009-09-23 西安电子科技大学 AVS video digital watermark method based on nonnegative matrix decomposition
CN103559676A (en) * 2013-10-11 2014-02-05 西安电子科技大学 Method for preventing color image blind watermarking from being printed and scanned based on DCT coefficient statistical property

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030073369A (en) * 2002-03-11 2003-09-19 한국전자통신연구원 A Real-time Blind Video Watermarking Method using Quantization
CN104539965B (en) * 2015-01-12 2017-08-01 中国电子科技集团公司第三十八研究所 A H.264/AVC compressed domain video watermark embedding and extraction method
CN104899823B (en) * 2015-07-03 2017-10-03 鲁东大学 The dual-color image blind watermarking method decomposed based on Hessenberg

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101540898A (en) * 2009-04-24 2009-09-23 西安电子科技大学 AVS video digital watermark method based on nonnegative matrix decomposition
CN103559676A (en) * 2013-10-11 2014-02-05 西安电子科技大学 Method for preventing color image blind watermarking from being printed and scanned based on DCT coefficient statistical property

Also Published As

Publication number Publication date
CN114998081A (en) 2022-09-02

Similar Documents

Publication Publication Date Title
Yang et al. A contrast-sensitive reversible visible image watermarking technique
CN107040787B (en) A kind of 3D-HEVC inter-frame information hidden method of view-based access control model perception
JP2012500565A (en) CABAC / AVC compliant watermarking of syntax elements in compressed video
Qi et al. Generic reversible visible watermarking via regularized graph fourier transform coding
JP2002325170A (en) Image processing apparatus and method, program code, and storage medium
CN102668560B (en) Embedded graphics coding: reordered bitstream for parallel decoding
CN101527850B (en) Video self-recovery watermark method based on motion estimation
CN104581176A (en) H.264/AVC (advanced video coding) compressed domain robust video watermark embedding and extracting methods free from intra-frame error drift
KR101346942B1 (en) Vector embedded graphics coding
Bhaumik et al. Data hiding in video
CN110798749B (en) Robust video watermarking method based on tensor singular value decomposition
CN114998081B (en) Video blind watermark embedding and extracting method based on H.265/HEVC
US20190089955A1 (en) Image encoding method, and image encoder and image decoder using same
Sakib et al. A robust DWT-based compressed domain video watermarking technique
CN111065000B (en) Video watermark processing method, device and storage medium
Fallahpour et al. Flexible image watermarking in JPEG domain
EP2544143B1 (en) Method for watermark detection using reference blocks comparison
CN108683921A (en) A kind of video reversible information hidden method based on zero quantization DCT coefficient group
CN115334316A (en) A HEVC Video Adaptive Steganography Method Without Intra-frame Distortion Drift
Ahmed et al. Design of quality improvement technique through ridgelet transform on watermarked video
Mohammed et al. Robust image watermarking scheme based on wavelet technique
CN106851436A (en) Video point shape Fragile Watermark Algorithm in DCT domain
Su et al. A new video steganalysis based on mode detection
Jain et al. A JPEG compression resistant steganography scheme for raster graphics images
CN102724494B (en) Method for embedding reversible watermark, extraction method thereof, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant