[go: up one dir, main page]

CN100492401C - A Method of Embedding and Extracting Watermark on Binary Image - Google Patents

A Method of Embedding and Extracting Watermark on Binary Image Download PDF

Info

Publication number
CN100492401C
CN100492401C CNB031292941A CN03129294A CN100492401C CN 100492401 C CN100492401 C CN 100492401C CN B031292941 A CNB031292941 A CN B031292941A CN 03129294 A CN03129294 A CN 03129294A CN 100492401 C CN100492401 C CN 100492401C
Authority
CN
China
Prior art keywords
watermark
image
binary image
matrix
sub
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.)
Expired - Fee Related
Application number
CNB031292941A
Other languages
Chinese (zh)
Other versions
CN1567353A (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.)
Shanghai Normal University
Original Assignee
Shanghai Normal University
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 Shanghai Normal University filed Critical Shanghai Normal University
Priority to CNB031292941A priority Critical patent/CN100492401C/en
Publication of CN1567353A publication Critical patent/CN1567353A/en
Application granted granted Critical
Publication of CN100492401C publication Critical patent/CN100492401C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

It is a method that embedded the watermark on binary image. It comprises the following steps: a. taking the edge of binary image; b. analyzing the edge point, and calculating the priority of variable pixel; c. mixing the binary image; d. convolutional encoding the watermark signal; e. embedding the watermark in the mixed binary image. The watermark-extracting method comprises: a'.mixing and blocking the binary image that embedded the watermark; b'. extracting a bit of watermark information from each sub-block; c'. Viterbi decoding the watermark matrix, and getting the wanted watermark. The method can change the priority by calculating edge point of binary image. When embedding the watermark, the point with high priority is considered first, which can realize the least distortion of binary image that embedded the watermark. This invention embeds a meaningful watermark signal in binary image, and the extraction of watermark need no information of original image information.

Description

一种在二值图像上嵌入水印以及提取水印的方法 A Method of Embedding and Extracting Watermark on Binary Image

技术领域 technical field

本发明涉及一种插入以及提取水印的方法,尤其涉及一种在二值图像上插入以及提取水印的方法。The invention relates to a method for inserting and extracting a watermark, in particular to a method for inserting and extracting a watermark on a binary image.

背景技术 Background technique

随着计算机网络和多媒体系统的快速发展,数字媒体(数字音频、数字图像、数字视频)被广泛应用,数字媒体的版权保护和完整性保护也成为一个亟待解决的问题。数字水印技术是解决该问题的有效方法之一。数字水印是将与数字媒体内容相关或不相关的一些标示信息直接嵌入到数字媒体内容当中,但不影响原内容的价值,并不能被人的知觉系统觉察或注意到。通过这些隐蔽在数字媒体内容中的信息,可以达到确认内容创建者、购买者,或者内容是否真实完整的目的。With the rapid development of computer networks and multimedia systems, digital media (digital audio, digital image, digital video) are widely used, and the copyright protection and integrity protection of digital media has become an urgent problem to be solved. Digital watermarking technology is one of the effective methods to solve this problem. Digital watermarking is to directly embed some marking information related or irrelevant to digital media content into digital media content, but it does not affect the value of the original content, and cannot be perceived or noticed by the human perception system. Through the information hidden in the digital media content, the purpose of confirming content creators, buyers, or whether the content is authentic and complete can be achieved.

目前提出的数字水印算法大都针对音频、视频、彩色图像和灰度图像等数字媒体。然而,能满足上述要求的针对二值图像(如地图、工程图纸、条形码、签名及传真文档等)的数字水印算法却很少见到。由于二值图像结构上的特殊性,已有的针对彩色或灰度图像的各种水印算法很难直接应用到二值图像。因为,对二值图像像素的修改很容易被检测到。目前已有的算法(见参考文献)鲁棒性不强,且嵌入水印后图像视觉效果不好。可对比的技术文献有以下四篇:Most of the currently proposed digital watermarking algorithms are aimed at digital media such as audio, video, color images and grayscale images. However, digital watermarking algorithms for binary images (such as maps, engineering drawings, barcodes, signatures and fax documents, etc.) that can meet the above requirements are rarely seen. Due to the particularity of binary image structure, the existing watermarking algorithms for color or grayscale images are difficult to apply directly to binary images. Because, modifications to binary image pixels are easily detected. The current existing algorithms (see references) are not robust, and the visual effect of the image after embedding the watermark is not good. There are four comparable technical literatures:

1.M.Y.Wu and J.H.Lee.“A Novel Data Embedding Method for Two-ColorFacsimile Image”in“Proceedings of International Symposium on MultimediaInformation Processing,”Tai-wan,R.O.C,December 1998。1. M.Y.Wu and J.H.Lee. “A Novel Data Embedding Method for Two-Color Facsimile Image” in “Proceedings of International Symposium on Multimedia Information Processing,” Tai-wan, R.O.C, December 1998.

2.H.C.Wang,C.Y.Lin,C.C.Huang,“Data Hiding in a binary image by themodified digital halftoning techniques,proceedings”,“1999Conference onComputer Vision,Graphics and Image Processing”,pp.183-190,Tanpei,Taiwan,August,1999。2. H.C.Wang, C.Y.Lin, C.C.Huang, "Data Hiding in a binary image by the modified digital halftoning techniques, proceedings", "1999 Conference on Computer Vision, Graphics and Image Processing", pp.183-190, Tanpei, Taiwan, August, 1999.

3.Yu-Yuan Chen,Hsiang-Kuang Pan,and Yu-Chee Tseng,,“A Secure DataHiding Scheme for Two-Color Image”,in“IEEE Symp.on Computers andCommunications”,2000。3. Yu-Yuan Chen, Hsiang-Kuang Pan, and Yu-Chee Tseng, "A Secure Data Hiding Scheme for Two-Color Image", in "IEEE Symp. on Computers and Communications", 2000.

4.Yu-Chee Tseng,,Hsiang-Kuang Pan,“Data Hiding in 2-Color Images”,“IEEE TRANSACTIONS ON COMPUTERS”,VOL.51,NO.7,JUL Y 2002。4. Yu-Chee Tseng, Hsiang-Kuang Pan, "Data Hiding in 2-Color Images", "IEEE TRANSACTIONS ON COMPUTERS", VOL.51, NO.7, JUL Y 2002.

发明内容 Contents of the invention

本发明的目的是提供一种在二值图像上插入以及提取水印的方法。该方法改善了嵌入水印后图像的视觉效果,同时该算法的鲁棒性也得到增强。The purpose of the present invention is to provide a method for inserting and extracting watermarks on binary images. This method improves the visual effect of the image after embedding the watermark, and the robustness of the algorithm is also enhanced.

为了达到上述目的,本发明采用如下技术方案:In order to achieve the above object, the present invention adopts following technical scheme:

一种在二值图像上嵌入水印的方法,包括以下步骤:A method for embedding a watermark on a binary image, comprising the following steps:

a.对二值图像提取边缘,用一个3×3的窗口从左到右,从上到下扫描全图像,用“1”表示黑像素,“0”表示白像素,对于3×3的窗口内如果像素性质不同(即有黑像素,又有白像素),且窗口的中心像素值为1,则确定该窗口的中心点是图像的边缘点,其余情况均不是边缘点;记录下这些边缘点,水印的嵌入都在边缘点进行;a. Extract the edge of the binary image, use a 3×3 window to scan the entire image from left to right, from top to bottom, use “1” to represent black pixels, and “0” to represent white pixels, for a 3×3 window If the nature of the pixels is different (that is, there are black pixels and white pixels), and the center pixel value of the window is 1, then it is determined that the center point of the window is the edge point of the image, and the other cases are not edge points; record these edges point, the embedding of the watermark is carried out at the edge point;

b.对边缘点进行分析,计算出可修改像素的优先级,以边缘点为中心,在3×3窗口内按照黑白像素的分布将边缘点分为4个优先级;b. Analyze the edge points, calculate the priority of modifiable pixels, center on the edge point, divide the edge point into 4 priorities according to the distribution of black and white pixels in the 3×3 window;

c.将二值图像置乱,将数字二值图像视为一个矩阵,黑点为1,白点为0,应用Arnold变换进行图像置乱,基于位置的图像置乱的Arnold变换可写为:c. Scramble the binary image, regard the digital binary image as a matrix, the black point is 1, the white point is 0, apply the Arnold transformation to scramble the image, the Arnold transformation of the position-based image scrambling can be written as:

xx ′′ ythe y ′′ == 11 11 11 22 xx ythe y (( modmod N N ))

其中x、y∈(0,1,2,...,N-1),表示某一像素点的坐标,x′、y′为变换后的坐标,,而N是图像矩阵的阶数;Wherein x, y ∈ (0, 1, 2, ..., N-1), represent the coordinates of a certain pixel point, x', y' are transformed coordinates, and N is the order of the image matrix;

d.水印预处理,在插入水印之前,对水印进行预处理,由于水印也为数字二值图像,也可将其视为一个矩阵,用卷积码对水印进行编码,即使用卷积码的生成矩阵乘以水印的数字图像矩阵;d. Watermark preprocessing. Before inserting the watermark, the watermark is preprocessed. Since the watermark is also a digital binary image, it can also be regarded as a matrix, and the watermark is encoded with a convolutional code, that is, the convolutional code is used. generate a digital image matrix multiplied by the watermark;

e.在置乱的二值图像中嵌入水印图像,首先将置乱的二值图像分割成互不相交的M×M大小的子块,M的取值与水印的数据量大小有关,设二值图像大小为N×N,水印图像经卷积编码后大小为I×I,则

Figure C03129294D00071
e. To embed the watermark image in the scrambled binary image, first divide the scrambled binary image into disjoint M×M sub-blocks, the value of M is related to the data size of the watermark, set two The size of the value image is N×N, and the size of the watermark image after convolution coding is I×I, then
Figure C03129294D00071

由于置乱后的二值图像被分成I2个所述M×M的子块,正好与水印编码后形成的I×I矩阵一一对应,每一个所述M×M的子块对应I×I水印矩阵相应位置上的点;Since the scrambled binary image is divided into 12 sub-blocks of M×M, which correspond to the I×I matrix formed after watermark encoding, each of the sub-blocks of M×M corresponds to I× The point on the corresponding position of the I watermark matrix;

如果该水印点为0,则在所述M×M的子块中嵌入0,If the watermark point is 0, then embed 0 in the M×M sub-block,

若所述M×M子块内黑像素的点的数目为偶数,则不做任何修改;If the number of points of black pixels in the M×M sub-block is an even number, no modification is made;

若所述M×M子块内黑像素的点的数目为奇数,则按照步骤b中所定的优先级,在优先级最高的点中选择一个并修改极性;If the number of points of black pixels in the M×M sub-block is an odd number, then according to the priority set in step b, select one of the points with the highest priority and modify the polarity;

如果该水印点为1,则在所述M×M的子块中嵌入1,If the watermark point is 1, then embed 1 in the M×M sub-block,

若所述M×M子块内黑像素的点的数目为奇数,则不做任何修改;If the number of black pixel points in the M×M sub-block is an odd number, no modification is made;

若所述M×M子块内黑像素的点的数目为偶数,则按照步骤b中所定的优先级,在优先级最高的点中选择一个并修改极性;If the number of points of black pixels in the M×M sub-block is an even number, then according to the priority set in step b, select one of the points with the highest priority and modify the polarity;

所有水印信息嵌入完成后,再对图像进行Arnold反变换,得到嵌入水印后的图像。After all the watermark information is embedded, the Arnold inverse transform is performed on the image to obtain the image after embedding the watermark.

一种提取水印的方法,提取按照上述方法嵌入的水印,包括以下步骤:A method for extracting a watermark, extracting a watermark embedded according to the above method, comprising the following steps:

a′.将嵌入水印的二值图像进行Arnold变换,使用的公式与嵌入该水印时步骤c使用的公式相同,将置乱后的二值图像划分若干互不相交的M×M子块,M的取值与嵌入该水印时M的取值相同,每个M×M的子块可提取一位水印信息,总共可提取I2为水印信息,I与嵌入水印时水印的大小I相同;a'. Arnold transform the binary image embedded with watermark, the formula used is the same as the formula used in step c when embedding the watermark, divide the scrambled binary image into several disjoint M×M sub-blocks, M The value of M is the same as the value of M when the watermark is embedded, and each M×M sub-block can extract one bit of watermark information, and a total of I2 can be extracted as watermark information, and I is the same as the size I of the watermark when the watermark is embedded;

b′.对每一M×M子块,b'. For each M×M sub-block,

如果子块内黑像素的点的数目为奇数,则提取的水印信息为1;If the number of points of black pixels in the sub-block is an odd number, the extracted watermark information is 1;

如果子块内黑像素的点的数目为偶数,则提取的水印信息为0;If the number of points of black pixels in the sub-block is even, the extracted watermark information is 0;

提取出的水印信息组成一个I×I的矩阵,该矩阵是嵌入的水印信息经卷积码编码后的矩阵;The extracted watermark information forms an I×I matrix, which is a matrix of embedded watermark information encoded by a convolutional code;

c′.使用Viterbi算法对I×I的水印矩阵进行译码,得到一个

Figure C03129294D00072
的矩阵,c'. Use the Viterbi algorithm to decode the I×I watermark matrix to obtain a
Figure C03129294D00072
matrix,

既是要提取的水印矩阵。It is the watermark matrix to be extracted.

由于采用了上述技术方案,本发明的在二值图像上插入以及提取水印的方法首先将水印信号进行卷积编码,然后嵌入到被保护的二值图像中,提取水印后,经Viterbi译码,得到水印信号,由于Viterbi算法具有较强的纠错能力,使该方法的水印图像在经过一些通用的几何变形操作后仍能够提取出一个可信赖的水印信号。Due to the adoption of the above technical solution, the method for inserting and extracting watermarks on binary images of the present invention first performs convolutional coding on the watermark signal, then embeds it into the protected binary image, extracts the watermark, and decodes it via Viterbi. The watermark signal is obtained, because the Viterbi algorithm has a strong error correction ability, so that the watermark image of this method can still extract a reliable watermark signal after some general geometric deformation operations.

附图说明 Description of drawings

图1是本发明的在二值图像上插入水印的方法的流程图;Fig. 1 is the flowchart of the method for inserting watermark on binary image of the present invention;

图2是本发明的在二值图像上提取水印的方法的流程图;Fig. 2 is the flow chart of the method for extracting watermark on binary image of the present invention;

图3是3×3窗口的优先级边缘特征示意图;Fig. 3 is a schematic diagram of priority edge features of a 3×3 window;

图4是Vierbi译码算法对于(2,1,2)卷积码在L=5时的网格图;Fig. 4 is the trellis diagram of the Vierbi decoding algorithm for (2,1,2) convolutional code when L=5;

图5一二值图像的原始情况图;The original situation figure of Fig. 5-binary image;

图6是对图5的二值图像所提取的边缘图像;Fig. 6 is the edge image extracted to the binary image of Fig. 5;

图7是一水印图像;Fig. 7 is a watermark image;

图8是图7的水印图像经卷积后得到的图像;Fig. 8 is the image obtained after the watermark image in Fig. 7 is convolved;

图9是图5的二值图像插入图7的水印后的图像;Fig. 9 is the image after the binary image of Fig. 5 is inserted into the watermark of Fig. 7;

图10是图9与图5的绝对误差图象;Fig. 10 is the absolute error image of Fig. 9 and Fig. 5;

图11是不经处理直接提取的水印图象;Fig. 11 is the watermark image directly extracted without processing;

图12是图5加水印后的图像经线性插值放大后提取的水印图像;Fig. 12 is the watermark image extracted after linear interpolation enlargement of the image after watermarking in Fig. 5;

图13是图5加水印后的图像经线性插值缩小后提取的水印图像;Fig. 13 is the watermark image extracted after the image watermarked in Fig. 5 is reduced by linear interpolation;

图14是图5加水印后的图像经一次裁剪的图像;Fig. 14 is the image that the image after Fig. 5 adds watermark is cropped once;

图15是从图14提取的水印图像;Figure 15 is the watermark image extracted from Figure 14;

图16是图5加水印后的图像经二次裁剪的图像;Fig. 16 is the image of the image after adding watermark in Fig. 5 through secondary cropping;

图17是从图16提取的水印图像;Figure 17 is the watermark image extracted from Figure 16;

图18图5加水印后的图像加入椒盐噪声后的图像;Figure 18 The image after adding salt and pepper noise to the watermarked image in Figure 5;

图19是从图18提取的水印图像。Figure 19 is the watermark image extracted from Figure 18.

具体实施方式 Detailed ways

下面结合附图和实施例来进一步说明本发明的技术方案。The technical solutions of the present invention will be further described below in conjunction with the drawings and embodiments.

图1是本发明的在二值图像上插入水印的方法的流程图,如图1所示,本发明的在二值图像上插入水印的方法包括以下步骤:Fig. 1 is the flowchart of the method for inserting watermark on binary image of the present invention, as shown in Fig. 1, the method for inserting watermark on binary image of the present invention comprises the following steps:

a.对二值图像提取边缘,用一个3×3的窗口从左到右,从上到下扫描全图像,用“1”表示黑像素,“0”表示白像素,对于3×3的窗口内如果像素性质不同(即有黑像素,又有白像素),且窗口的中心像素值为1,则确定该窗口的中心点是图像的边缘点,其余情况均不是边缘点;记录下这些边缘点,水印的嵌入都在边缘点进行。上述实施例中,使用的是一个3×3的窗口来扫描全图像,也可以使用一个5×5或一个7×7的窗口来进行扫描,但使用3×3的窗口是最方便的。图5是一个二值图像的原始图像,图6是按照上述实施例所述的使用3×3窗口提取边缘点后得到的图像。a. Extract the edge of the binary image, use a 3×3 window to scan the entire image from left to right, from top to bottom, use “1” to represent black pixels, and “0” to represent white pixels, for a 3×3 window If the nature of the pixels is different (that is, there are black pixels and white pixels), and the center pixel value of the window is 1, then it is determined that the center point of the window is the edge point of the image, and the other cases are not edge points; record these edges point, the embedding of the watermark is performed at the edge point. In the above embodiments, a 3×3 window is used to scan the entire image, and a 5×5 or 7×7 window can also be used for scanning, but it is most convenient to use a 3×3 window. FIG. 5 is an original image of a binary image, and FIG. 6 is an image obtained after using a 3×3 window to extract edge points according to the above embodiment.

b.对边缘点进行分析,计算出可修改像素的优先级,以上述实施例中的3×3窗口为例,以边缘点为中心,在3×3窗口内按照黑白像素的分布将边缘点分为4个优先级。图3是3×3窗口的优先级边缘特征示意图,若该中心边缘点水平或垂直的两点是黑像素,如图3的(a),(b)所示的情况,则设该中心边缘点的可修改优先级为1级;如中心边缘点与其它两点黑像素构成45度或135度斜边缘,如图3的(c),(d)所示的情况,则设该中心边缘点的可修改优先级为2级;如果边缘分布如图(e),(f),(g),(h)所示的情况,则中心边缘点可修改优先级为3级;如边缘分布如图(i),(j),(k),(1)所示,则中心边缘点可修改优先级为4级,其中灰色的点表示可由白变黑。b. Analyze the edge points and calculate the priority of the modifiable pixels. Taking the 3×3 window in the above embodiment as an example, take the edge point as the center, and divide the edge points according to the distribution of black and white pixels in the 3×3 window Divided into 4 priorities. Figure 3 is a schematic diagram of the priority edge features of a 3×3 window, if the two horizontal or vertical points of the central edge point are black pixels, as shown in (a) and (b) of Figure 3, then set the central edge The modifiable priority of the point is level 1; if the central edge point forms a 45-degree or 135-degree oblique edge with other two black pixels, as shown in (c) and (d) of Figure 3, the central edge The modifiable priority of the point is level 2; if the edge distribution is as shown in the figure (e), (f), (g), (h), the modifiable priority of the center edge point is level 3; such as the edge distribution As shown in Figures (i), (j), (k), and (1), the center edge point can be modified to a priority of 4, where the gray point indicates that it can be changed from white to black.

c.将二值图像置乱,置乱算法可作为密钥用在水印的嵌入和提取算法中。置乱的目的有两个:(1)将图像中可修改的像素均匀分布在图像的每一部分;(2)增加算法的保密性。将置乱后的图像进一步分割成许多大小相同的子块,每个子块嵌入一位水印信息。将数字二值图像视为一个矩阵,黑点为1,白点为0,应用Arnold变换进行图像置乱,基于位置的图像置乱的Arnold变换可写为:c. Scrambling the binary image, the scrambling algorithm can be used as a key in the watermark embedding and extraction algorithm. There are two purposes of scrambling: (1) evenly distribute the modifiable pixels in each part of the image; (2) increase the confidentiality of the algorithm. The scrambled image is further divided into many sub-blocks of the same size, and one bit of watermark information is embedded in each sub-block. The digital binary image is regarded as a matrix, the black point is 1, and the white point is 0, and the Arnold transformation is applied for image scrambling. The Arnold transformation of position-based image scrambling can be written as:

xx ′′ ythe y ′′ == 11 11 11 22 xx ythe y (( modmod NN ))

其中x、y∈(0,1,2,...,N-1),表示某一像素点的坐标,x′、y′为变换后的坐标,,而N是图像矩阵的阶数;Wherein x, y ∈ (0, 1, 2, ..., N-1), represent the coordinates of a certain pixel point, x', y' are transformed coordinates, and N is the order of the image matrix;

d.水印预处理,在插入水印之前,对水印进行预处理,由于水印也为数字二值图像,也可将其视为一个矩阵,用卷积码对水印进行编码,即使用卷积码的生成矩阵乘以水印的数字图像矩阵。卷积编码中,本组的校验元不仅与本组的信息元有关,而且还与以前的各时刻输入至编码器的信息组有关。在卷积码译码过程中,不仅从此时刻收到的码组中提取译码信息,而且还要利用以前或以后各时刻收到的码组中提取有关信息。以(2,1,2)卷积码为例,它的生成矩阵是G(D)=(1+D+D2,1+D2),1表示当前的输入,D表示前一个时间段的输入,D2表示前两个时间段的输入。如输入序列M=(0010100001),则由(2,1,2)编码器输出的码序列C=(00,00,11,10,00,10,11,00,00,11)。d. Watermark preprocessing. Before inserting the watermark, the watermark is preprocessed. Since the watermark is also a digital binary image, it can also be regarded as a matrix, and the watermark is encoded with a convolutional code, that is, the convolutional code is used. A digital image matrix that generates a matrix multiplied by a watermark. In convolutional coding, the parity element of this group is not only related to the information element of this group, but also related to the information group input to the encoder at each previous moment. In the decoding process of convolutional codes, not only the decoding information is extracted from the code group received at this moment, but also relevant information is extracted from the code group received at previous or subsequent times. Taking (2, 1, 2) convolutional code as an example, its generator matrix is G(D)=(1+D+D 2 , 1+D 2 ), 1 represents the current input, and D represents the previous time period The input of D2 represents the input of the previous two time periods. If the input sequence M=(0010100001), then the code sequence C=(00,00,11,10,00,10,11,00,00,11) output by the (2,1,2) encoder.

本实施例中,采用上述(2,1,2)卷积码及其生成矩阵,当然也可采用其他形式的卷积码。由于采用(2,1,2)卷积码,本实施例中,需要插入的水印应符合长宽之比为2∶1,即水印是一个

Figure C03129294D00101
矩阵,这样,在经(2,1,2)卷积码编码后,可将水印变成一个I×I的数字矩阵。In this embodiment, the above-mentioned (2, 1, 2) convolutional code and its generation matrix are used, and of course other forms of convolutional codes may also be used. Due to the use of (2, 1, 2) convolutional codes, in this embodiment, the watermark to be inserted should meet the aspect ratio of 2:1, that is, the watermark is a
Figure C03129294D00101
In this way, after being encoded by (2, 1, 2) convolutional code, the watermark can be changed into a digital matrix of I×I.

图7是一个水印的原始图像,图8是该水印采用上述实施例所述的(2,1,2)卷积码编码后的图像。Fig. 7 is an original image of a watermark, and Fig. 8 is an image of the watermark encoded by the (2, 1, 2) convolutional code described in the above embodiment.

e.在置乱的二值图像中嵌入水印图像,首先将置乱的二值图像分割成互不相交的M×M大小的子块,M的取值与水印的数据量大小有关,设二值图像大小为N×N,水印图像经卷积编码后大小为I×I,则;由于M采用了上述取值方法,通过计算可知,一个N×N的水印图像可以分成I2块,正好与编码后的水印矩阵内点的数目相等,因此可以做到每一子块对应一个水印矩阵中的点。e. To embed the watermark image in the scrambled binary image, first divide the scrambled binary image into disjoint M×M sub-blocks, the value of M is related to the data size of the watermark, set two The size of the value image is N×N, and the size of the watermark image after convolution coding is I×I, then ; Since M adopts the above-mentioned value-taking method, it can be known by calculation that an N×N watermark image can be divided into I 2 blocks, which is just equal to the number of points in the encoded watermark matrix, so each sub-block can correspond to a Points in the watermark matrix.

由于置乱后的二值图像被分成I2个所述M×M的子块,正好与水印编码后形成的I×I矩阵一一对应,每一个所述M×M的子块对应I×I水印矩阵相应位置上的点;Since the scrambled binary image is divided into 12 sub-blocks of M×M, which correspond to the I×I matrix formed after watermark encoding, each of the sub-blocks of M×M corresponds to I× The point on the corresponding position of the I watermark matrix;

如果该水印点为0,则在所述M×M的子块中嵌入0,If the watermark point is 0, then embed 0 in the M×M sub-block,

若所述M×M子块内黑像素的点的数目为偶数,则不做任何修改;If the number of points of black pixels in the M×M sub-block is an even number, no modification is made;

若所述M×M子块内黑像素的点的数目为奇数,则按照步骤b中所定的优先级,在优先级最高的点中选择一个并修改极性;If the number of points of black pixels in the M×M sub-block is an odd number, then according to the priority set in step b, select one of the points with the highest priority and modify the polarity;

如果该水印点为1,则在所述M×M的子块中嵌入1,If the watermark point is 1, then embed 1 in the M×M sub-block,

若所述M×M子块内黑像素的点的数目为奇数,则不做任何修改;If the number of black pixel points in the M×M sub-block is an odd number, no modification is made;

若所述M×M子块内黑像素的点的数目为偶数,则按照步骤b中所定的优先级,在优先级最高的点中选择一个并修改极性;If the number of points of black pixels in the M×M sub-block is an even number, then according to the priority set in step b, select one of the points with the highest priority and modify the polarity;

所有水印信息嵌入完成后,再对图像进行Arnold反变换,得到嵌入水印后的图像。After all the watermark information is embedded, the Arnold inverse transform is performed on the image to obtain the image after embedding the watermark.

为了达到较好的效果,二值图像的边长至少为水印图像的边长的6倍,即N≥6I。In order to achieve a better effect, the side length of the binary image is at least 6 times the side length of the watermark image, that is, N≥6I.

图9是图5的二值图像插入图7的水印后的图像;Fig. 9 is the image after the binary image of Fig. 5 is inserted into the watermark of Fig. 7;

图10是图9与图5的绝对误差图象。FIG. 10 is an absolute error graph of FIG. 9 and FIG. 5 .

图2是本发明的在二值图像上提取水印的方法的流程图,包括以下步骤:Fig. 2 is the flowchart of the method for extracting watermark on binary image of the present invention, comprises the following steps:

a′.将嵌入水印的二值图像进行Arnold变换,使用的公式与嵌入该水印时步骤c使用的公式相同,将置乱后的二值图像划分若干互不相交的M×M子块,M的取值与嵌入该水印时M的取值相同,每个M×M的子块可提取一位水印信息,总共可提取I2为水印信息,I与嵌入水印时水印的大小I相同;a'. Arnold transform the binary image embedded with watermark, the formula used is the same as the formula used in step c when embedding the watermark, divide the scrambled binary image into several disjoint M×M sub-blocks, M The value of M is the same as the value of M when the watermark is embedded, and each M×M sub-block can extract one bit of watermark information, and a total of I2 can be extracted as watermark information, and I is the same as the size I of the watermark when the watermark is embedded;

b′.对每一M×M子块,b'. For each M×M sub-block,

如果子块内黑像素的点的数目为奇数,则提取的水印信息为1;If the number of points of black pixels in the sub-block is an odd number, the extracted watermark information is 1;

如果子块内黑像素的点的数目为偶数,则提取的水印信息为0;If the number of points of black pixels in the sub-block is even, the extracted watermark information is 0;

提取出的水印信息组成一个I×I的矩阵,该矩阵是嵌入的水印信息经卷积码编码后的矩阵;The extracted watermark information forms an I×I matrix, which is a matrix of embedded watermark information encoded by a convolutional code;

c′.使用Viterbi算法对I×I的水印矩阵进行译码,得到一个

Figure C03129294D00111
的矩阵,既是要提取的水印矩阵。Viterbi算法是一种最大似然译码算法,编码器从全为0的S0状态时所输出的码序列,称为结尾卷积码序列。因此,当送完L段信息序列后,还必须在送入m段全0序列。图4是Vierbi译码算法对于(2,1,2)卷积码在L=5时的网格图。如图4所示,图中实线表示输入为0,虚线表示输入为1。S0S1S2S3表示的时编码器的4种状态。该实施例采用的是Viterbi的硬判决,对于(2,1,2)卷积码,每个状态的入度为2,如当前时刻的状态S0它接受由前一时刻S0S2状态转入的分支值(00)(11)。设前一时刻S0S2所经过的路径分别为pathl、path3,最小海明距离分别为d1、d3。将输入的值与(00)(11)比较,所得的距离为D1、D3,选择d1+D1、d3+D3中小的一个值给d1,当前选择的路径就是海明距离小的那条路径,更新pathl的值。其他三条路径的选择同样。当全部输入完毕后,从四条路径中选取一条海明距离最小的即为所要的路径,该路径上的值就是译码值。c'. Use the Viterbi algorithm to decode the I×I watermark matrix to obtain a
Figure C03129294D00111
The matrix of is the watermark matrix to be extracted. The Viterbi algorithm is a maximum likelihood decoding algorithm. The code sequence output by the encoder from the S 0 state of all 0s is called the end convolutional code sequence. Therefore, after the L-segment information sequence is sent, the m-segment all-0 sequence must be sent. FIG. 4 is a trellis diagram of the Vierbi decoding algorithm for (2, 1, 2) convolutional codes when L=5. As shown in Figure 4, the solid line in the figure indicates that the input is 0, and the dotted line indicates that the input is 1. S 0 S 1 S 2 S 3 represents the 4 states of the encoder. This embodiment adopts Viterbi's hard decision. For (2, 1, 2) convolutional codes, the in-degree of each state is 2, such as the state S 0 at the current moment, which accepts the state S 0 S 2 from the previous moment The value of the branch transferred in (00)(11). Assume that the paths S 0 S 2 passed at the previous moment are path1 and path3 respectively, and the minimum Hamming distances are d1 and d3 respectively. Comparing the input value with (00)(11), the obtained distances are D1 and D3, select the smaller value among d1+D1 and d3+D3 for d1, the currently selected path is the path with the smaller Hamming distance, Update the value of pathl. The selection of the other three paths is the same. After all the input is completed, select a path with the smallest Hamming distance from the four paths as the desired path, and the value on this path is the decoding value.

由于Viterbi算法具有较强的纠错能力,使该方法的水印图像在经过一些通用的几何变形操作后仍能够提取出一个可信赖的水印信号。Because the Viterbi algorithm has strong error correction ability, the watermarked image of this method can still extract a reliable watermark signal after some general geometric deformation operations.

图11是不经处理直接提取的水印图象;图12是图5加水印后的图像经线性插值放大后提取的水印图像;图13是图5加水印后的图像经线性插值缩小后提取的水印图像。比较这3张图可知,由于使用了Viterbi算法,对于几何变形操作后所提取的水印仍是可以辨认的。Figure 11 is the watermark image directly extracted without processing; Figure 12 is the watermark image extracted after the watermarked image in Figure 5 is enlarged by linear interpolation; Figure 13 is the watermarked image in Figure 5 extracted after linear interpolation reduction Watermark image. Comparing these three pictures, it can be seen that due to the use of the Viterbi algorithm, the watermark extracted after the geometric deformation operation is still recognizable.

下面再几个例子来进一步说明本发明的在二值图像上嵌入水印以及提取水印的方法具有较强的纠错能力和鲁棒性。Several examples are given below to further illustrate that the method of the present invention for embedding a watermark on a binary image and extracting a watermark has strong error correction capability and robustness.

图14是图5加水印后的图像经一次裁剪的图像;图15是从图14提取的水印图像。Figure 14 is the cropped image of the watermarked image in Figure 5; Figure 15 is the watermarked image extracted from Figure 14.

图16是图5加水印后的图像经二次裁剪的图像;图17是从图16提取的水印图像。Fig. 16 is the image of the watermarked image in Fig. 5 after secondary cropping; Fig. 17 is the watermarked image extracted from Fig. 16 .

图18图5加水印后的图像加入椒盐噪声后的图像;图19是从图18提取的水印图像。Figure 18 is the watermarked image in Figure 5 and the image after adding salt and pepper noise; Figure 19 is the watermarked image extracted from Figure 18.

从上述3个例子可以看出,本发明的在二值图像上嵌入水印以及提取水印的方法具有较强的抗干扰的能力,在加入噪声的情况下仍可以提取出一个较清晰,可信赖的水印。It can be seen from the above three examples that the method for embedding and extracting watermarks on binary images of the present invention has strong anti-interference ability, and can still extract a clearer and more reliable image when noise is added. watermark.

本发明与现有技术比较有以下优点:Compared with the prior art, the present invention has the following advantages:

对二值图像的边缘点进行分析与分类,计算边缘点的可修改优先级别,水印嵌入时优先考虑级别高的点;这样保证了嵌入水印后的二值图像失真度最小;Analyze and classify the edge points of the binary image, calculate the modifiable priority level of the edge points, and give priority to the points with a higher level when embedding the watermark; this ensures the minimum distortion of the binary image after the watermark is embedded;

水印的提取过程不需要任何原图像信息;The watermark extraction process does not require any original image information;

用Vierbi译码算法使得水印的提取具有很强的纠错能力,该技术在水印的保密性与鲁棒性方面均有显著的提高。Using the Vierbi decoding algorithm makes the watermark extraction have a strong error correction ability, and this technology has significantly improved the confidentiality and robustness of the watermark.

Claims (5)

1.一种在二值图像上嵌入水印的方法,包括以下步骤:1. A method for embedding a watermark on a binary image, comprising the following steps: a.对二值图像提取边缘,用一个3×3的窗口从左到右,从上到下扫描全图像,用“1”表示黑像素,“0”表示白像素,对于3×3的窗口内如果像素性质不同,即有黑像素,又有白像素,且窗口的中心像素值为1,则确定该窗口的中心点是图像的边缘点,其余情况均不是边缘点;记录下这些边缘点,水印的嵌入都在边缘点进行;a. Extract the edge of the binary image, use a 3×3 window to scan the entire image from left to right, from top to bottom, use “1” to represent black pixels, and “0” to represent white pixels, for a 3×3 window If the nature of the pixels is different, that is, there are black pixels and white pixels, and the center pixel value of the window is 1, then it is determined that the center point of the window is the edge point of the image, and the other cases are not edge points; record these edge points , the embedding of the watermark is carried out at the edge point; b.对边缘点进行分析,计算出可修改像素的优先级,以边缘点为中心,在3×3窗口内按照黑白像素的分布将边缘点分为4个优先级;b. Analyze the edge points, calculate the priority of modifiable pixels, center on the edge point, divide the edge point into 4 priorities according to the distribution of black and white pixels in the 3×3 window; c.将二值图像置乱,将数字二值图像视为一个矩阵,黑点为1,白点为0,应用Arnold变换进行图像置乱,基于位置的图像置乱的Arnold变换可写为:c. Scramble the binary image, regard the digital binary image as a matrix, the black point is 1, the white point is 0, apply the Arnold transformation to scramble the image, the Arnold transformation of the position-based image scrambling can be written as: xx ′′ ythe y ′′ == 11 11 11 22 xx ythe y (( modmod N N )) 其中x、y∈(0,1,2,...,N-1),表示某一像素点的坐标,x′、y′为变换后的坐标,而N是图像矩阵的阶数;Wherein x, y ∈ (0, 1, 2, ..., N-1), represent the coordinates of a certain pixel point, x', y' are transformed coordinates, and N is the order of the image matrix; d.水印预处理,在插入水印之前,对水印进行预处理,用卷积码对水印进行编码,即使用卷积码的生成矩阵乘以水印的数字图像矩阵;d. Watermark preprocessing, before inserting the watermark, the watermark is preprocessed, and the watermark is encoded with a convolutional code, that is, the digital image matrix of the watermark is multiplied by the generation matrix of the convolutional code; e.在置乱的二值图像中嵌入水印图像,首先将置乱的二值图像分割成互不相交的M×M大小的子块,M的取值与水印的数据量大小有关,设二值图像大小为N×N,水印图像经卷积编码后大小为I×I,则M=取整
Figure C03129294C00022
e. To embed the watermark image in the scrambled binary image, first divide the scrambled binary image into disjoint M×M sub-blocks, the value of M is related to the data size of the watermark, set two The size of the value image is N×N, and the size of the watermark image after convolutional encoding is I×I, then M=rounding
Figure C03129294C00022
置乱后的二值图像被分成I2个所述M×M的子块,与水印编码后形成的I×I矩阵一一对应,每一个所述M×M的子块对应I×I水印矩阵相应位置上的点;The binary image after scrambling is divided into 1 or 2 sub-blocks of M×M, corresponding to the I×I matrix formed after watermark encoding, and each of the sub-blocks of M×M corresponds to I×I watermark Points at the corresponding positions of the matrix; 如果该水印点为0,则在所述M×M的子块中嵌入0,If the watermark point is 0, then embed 0 in the M×M sub-block, 若所述M×M子块内黑像素的点的数目为偶数,则不做任何修改;If the number of points of black pixels in the M×M sub-block is an even number, no modification is made; 若所述M×M子块内黑像素的点的数目为奇数,则按照步骤b中所定的优先级,在优先级最高的点中选择一个并修改极性;If the number of points of black pixels in the M×M sub-block is an odd number, then according to the priority set in step b, select one of the points with the highest priority and modify the polarity; 如果该水印点为1,则在所述M×M的子块中嵌入1,If the watermark point is 1, then embed 1 in the M×M sub-block, 若所述M×M子块内黑像素的点的数目为奇数,则不做任何修改;If the number of black pixel points in the M×M sub-block is an odd number, no modification is made; 若所述M×M子块内黑像素的点的数目为偶数,则按照步骤b中所定的优先级,在优先级最高的点中选择一个并修改极性;If the number of points of black pixels in the M×M sub-block is an even number, then according to the priority set in step b, select one of the points with the highest priority and modify the polarity; 所有水印信息嵌入完成后,再对图像进行Arnold反变换,得到嵌入水印后的图像。After all the watermark information is embedded, the Arnold inverse transform is performed on the image to obtain the image after embedding the watermark.
2.如权利要求1所述的在二值图像上嵌入水印的方法,其特征在于,所述水印为一矩形,长是其宽的2倍,为一
Figure C03129294C00031
矩阵。
2. the method for embedding watermark on binary image as claimed in claim 1, is characterized in that, described watermark is a rectangle, and length is 2 times of its width, is a
Figure C03129294C00031
matrix.
3.如权利要求2所述的在二值图像上嵌入水印的方法,其特征在于,所述步骤d水印预处理,采用(2,1,2)卷积码对水印进行编码,它的生成矩阵是G(D)=(1+D+D2,1+D2),1表示当前的输入,D表示前一个时间段的输入,D2表示前两个时间段的输入,与所述的水印数字矩阵相乘后形成一I×I的矩阵。3. the method for embedding watermark on binary image as claimed in claim 2, it is characterized in that, described step d watermark preprocessing adopts (2,1,2) convolutional code to encode watermark, its generation The matrix is G(D)=(1+D+D 2 , 1+D 2 ), 1 represents the current input, D represents the input of the previous time period, D 2 represents the input of the previous two time periods, and the A matrix of I×I is formed after multiplication of the watermark digital matrix. 4.如权利要求1或2所述的在二值图像上嵌入水印的方法,其特征在于,所述二值图像的边长至少为所述水印图像的边长的6倍,即N≥6I。4. The method for embedding a watermark on a binary image as claimed in claim 1 or 2, wherein the side length of the binary image is at least 6 times the side length of the watermark image, that is, N≥6I . 5.一种提取水印的方法,提取按照权利要求1所述的方法嵌入的水印,包括以下步骤:5. A method for extracting a watermark, extracting the watermark embedded in the method according to claim 1, comprising the following steps: a′.将嵌入水印的二值图像进行Arnold变换,使用的公式与嵌入该水印时步骤c使用的公式相同,将置乱后的二值图像划分若干互不相交的M×M子块,M的取值与嵌入该水印时M的取值相同,每个M×M的子块可提取一位水印信息,总共可提取I2为水印信息,I与嵌入水印时水印的大小I相同;a'. Arnold transform the binary image embedded with watermark, the formula used is the same as the formula used in step c when embedding the watermark, divide the scrambled binary image into several disjoint M×M sub-blocks, M The value of M is the same as the value of M when the watermark is embedded, and each M×M sub-block can extract one bit of watermark information, and a total of I2 can be extracted as watermark information, and I is the same as the size I of the watermark when the watermark is embedded; b′.对每一M×M子块,b'. For each M×M sub-block, 如果子块内黑像素的点的数目为奇数,则提取的水印信息为1;If the number of points of black pixels in the sub-block is an odd number, the extracted watermark information is 1; 如果子块内黑像素的点的数目为偶数,则提取的水印信息为0;If the number of points of black pixels in the sub-block is even, the extracted watermark information is 0; 提取出的水印信息组成一个I×I的矩阵,该矩阵是嵌入的水印信息经卷积码编码后的矩阵;The extracted watermark information forms an I×I matrix, which is a matrix of embedded watermark information encoded by a convolutional code; c′.使用Viterbi算法对I×I的水印矩阵进行译码,得到一个
Figure C03129294C00041
的矩阵,既是要提取的水印矩阵。
c'. Use the Viterbi algorithm to decode the I×I watermark matrix to obtain a
Figure C03129294C00041
The matrix of is the watermark matrix to be extracted.
CNB031292941A 2003-06-13 2003-06-13 A Method of Embedding and Extracting Watermark on Binary Image Expired - Fee Related CN100492401C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB031292941A CN100492401C (en) 2003-06-13 2003-06-13 A Method of Embedding and Extracting Watermark on Binary Image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB031292941A CN100492401C (en) 2003-06-13 2003-06-13 A Method of Embedding and Extracting Watermark on Binary Image

Publications (2)

Publication Number Publication Date
CN1567353A CN1567353A (en) 2005-01-19
CN100492401C true CN100492401C (en) 2009-05-27

Family

ID=34469268

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB031292941A Expired - Fee Related CN100492401C (en) 2003-06-13 2003-06-13 A Method of Embedding and Extracting Watermark on Binary Image

Country Status (1)

Country Link
CN (1) CN100492401C (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102306369A (en) * 2011-07-13 2012-01-04 西安电子科技大学 Anti-printing and scanning watermark algorithm for two-value text image based on row space and word space
CN108629728A (en) * 2018-05-06 2018-10-09 北京工业大学 A kind of high power capacity bianry image information concealing method
CN111445376B (en) * 2020-03-24 2023-08-18 五八有限公司 Video watermark detection method, device, electronic equipment and storage medium
CN111489278B (en) * 2020-04-07 2023-05-16 贵州大学 A text watermark embedding extraction method based on scrambling diffusion

Also Published As

Publication number Publication date
CN1567353A (en) 2005-01-19

Similar Documents

Publication Publication Date Title
Shi et al. Reversible data hiding: Advances in the past two decades
Puate et al. Using fractal compression scheme to embed a digital signature into an image
Caldelli et al. Reversible watermarking techniques: An overview and a classification
Pereira et al. Optimal transform domain watermark embedding via linear programming
Chang et al. Reversible data-embedding scheme using differences between original and predicted pixel values
He et al. Robust blind video watermarking against geometric deformations and online video sharing platform processing
CN107688731B (en) Digital watermarking algorithm based on text document protection
JP2002325170A (en) Image processing apparatus and method, program code, and storage medium
CN105741224A (en) Reversible watermarking algorithm based on PVO (Pixel Value Ordering) and self-adaptive block segmentation
Yang et al. A steganographic method for digital images by multi-pixel differencing
Lin et al. Digital images watermarking by vector quantization
Lin et al. Efficient electronic patient information hiding scheme with tamper detection function for medical images
Zhang et al. Blind dual watermarking scheme using stucki kernel and spiht for image self-recovery
CN100492401C (en) A Method of Embedding and Extracting Watermark on Binary Image
Tefas et al. Multi-bit image watermarking robust to geometric distortions
CN115063280B (en) A watermark superposition and restoration method and device
Yamamoto et al. Method of spread spectrum watermarking using quantization index modulation for cropped images
CN111263165A (en) A kind of embedding method and extraction method of HEVC video steganographic information
Hemalatha et al. Reversible data hiding based on varying radix numeral system
Lee et al. Temporal feature modulation for video watermarking
Pröfrock et al. Content-based watermarking by geometric warping and feature-based image segmentation
Nair et al. An improved image steganography method with SPIHT and arithmetic coding
US20240013335A1 (en) Digital image watermarking
Lin et al. A robust watermarking scheme combined with the FSVQ for images
JP3664594B2 (en) Method for embedding watermark information in image, method for decoding watermark information, and recording medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090527

Termination date: 20100613