CN101394553A - Image encryption and decryption method and device - Google Patents
Image encryption and decryption method and device Download PDFInfo
- Publication number
- CN101394553A CN101394553A CNA2008101688530A CN200810168853A CN101394553A CN 101394553 A CN101394553 A CN 101394553A CN A2008101688530 A CNA2008101688530 A CN A2008101688530A CN 200810168853 A CN200810168853 A CN 200810168853A CN 101394553 A CN101394553 A CN 101394553A
- Authority
- CN
- China
- Prior art keywords
- coefficient
- group
- image
- coefficients
- low frequency
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Editing Of Facsimile Originals (AREA)
- Image Processing (AREA)
Abstract
本发明实施例公开了图像加密的方法,包括:获取图像的低频系数;将所述低频系数分为至少两组系数;从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行加密。同时,还提供了一种图像解密的方法,包括:接收加密的图像;获取所述图像的低频系数;将所述低频系数分为至少两组系数;从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行解密。上述方案,通过将图像的低频系数分成至少两组,选取至少一组系数进行加密,克服现有技术中因加密的系数固定且公开,造成保密性差的问题。本发明实施例还相应公开了一种图像加密装置和图像解密装置。
The embodiment of the present invention discloses an image encryption method, comprising: acquiring low-frequency coefficients of an image; dividing the low-frequency coefficients into at least two groups of coefficients; selecting at least one group of coefficients from the at least two groups of coefficients, and selecting the selected At least one set of coefficients is encrypted. At the same time, a method for decrypting an image is also provided, including: receiving an encrypted image; obtaining low-frequency coefficients of the image; dividing the low-frequency coefficients into at least two groups of coefficients; selecting at least one of the at least two groups of coefficients A set of coefficients, decrypting the selected at least one set of coefficients. The above solution overcomes the problem of poor confidentiality caused by fixed and public encrypted coefficients in the prior art by dividing the low-frequency coefficients of the image into at least two groups and selecting at least one group of coefficients for encryption. The embodiment of the invention also correspondingly discloses an image encryption device and an image decryption device.
Description
技术领域 technical field
本发明涉及图多媒体技术领域,尤其涉及图像解密、解密的方法、装置。The present invention relates to the technical field of image multimedia, in particular to image decryption, a method and a device for decrypting.
背景技术 Background technique
随着图像在网络中的快捷传输和广泛使用。用户对图像信息的版权认证和安全传输提出了更高的要求。对图像版权的认证,可采用数字水印技术,将版权信息隐藏到图像里,达到鉴定作品的所有权和追踪非法侵权源头的目的;对图像信息的安全传输,可采用图像加密技术,隐藏图像本身的真实信息,保证信息在信道中的安全传输。With the rapid transmission and wide use of images in the network. Users have put forward higher requirements for copyright authentication and secure transmission of image information. For the authentication of image copyright, digital watermarking technology can be used to hide copyright information in the image to achieve the purpose of identifying the ownership of the work and tracking the source of illegal infringement; for the safe transmission of image information, image encryption technology can be used to hide the identity of the image itself. Authentic information to ensure the safe transmission of information in the channel.
为了满足对图像信息的版权认证和安全传输的要求,提出了一套水印和加密联合保护图像的方法。该方法包括:将图像划分成8*8像素的图像块,对每个图像块进行DCT(Discrete Cosine Transform,离散余弦变换)变换,得到8*8的DCT变换的系数矩阵,其中每个系数矩阵的直流系统用于加密,交流系统用于嵌入水印。经过网络传输,用户得到加密和嵌入水印的图像,通过合法的密钥解密得到嵌入水印的图像。In order to meet the requirements of copyright authentication and secure transmission of image information, a method of jointly protecting images by watermarking and encryption is proposed. The method includes: dividing the image into image blocks of 8*8 pixels, performing DCT (Discrete Cosine Transform, discrete cosine transform) transformation on each image block, and obtaining a coefficient matrix of DCT transformation of 8*8, wherein each coefficient matrix The DC system is used for encryption, and the AC system is used for embedding watermarks. After network transmission, the user gets the encrypted and watermarked image, and decrypts it with a legal key to get the watermarked image.
在实现本发明过程中,发明人发现现有技术中至少存在以下问题:上述方法中嵌入水印和加密的系数分别固定为系数矩阵中交流系数和直流系数,即加密的区域是固定的,加密容易被攻击者破解,安全性不高。In the process of realizing the present invention, the inventors found that there are at least the following problems in the prior art: the coefficients embedded in the watermark and encrypted in the above method are respectively fixed as the AC coefficient and the DC coefficient in the coefficient matrix, that is, the encrypted area is fixed, and the encryption is easy. Being cracked by an attacker, the security is not high.
发明内容 Contents of the invention
本发明实施例提供了图像加密、解密方法和装置,加密区域不是固定的,提高了安全性。The embodiment of the present invention provides an image encryption and decryption method and device, the encryption area is not fixed, and the security is improved.
一种图像解密方法,包括:An image decryption method, comprising:
获取图像的低频系数;Obtain the low frequency coefficient of the image;
将所述低频系数分为至少两组系数;dividing the low frequency coefficients into at least two groups of coefficients;
从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行加密。Select at least one set of coefficients from the at least two sets of coefficients, and encrypt the selected at least one set of coefficients.
一种图像解密方法,包括:An image decryption method, comprising:
接收加密的图像;Receive encrypted images;
获取所述图像的低频系数;Obtaining low-frequency coefficients of the image;
将所述低频系数分为至少两组系数;dividing the low frequency coefficients into at least two groups of coefficients;
从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行解密。Select at least one set of coefficients from the at least two sets of coefficients, and decrypt the selected at least one set of coefficients.
一种图像加密装置,包括:An image encryption device, comprising:
系数获取模块,用于获取图像的低频系数;A coefficient acquisition module, configured to acquire low-frequency coefficients of an image;
系数分组模块,用于将所述低频系数分为至少两组系数;a coefficient grouping module, configured to divide the low-frequency coefficients into at least two groups of coefficients;
加密模块,用于从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行加密。An encryption module, configured to select at least one set of coefficients from the at least two sets of coefficients, and encrypt the selected at least one set of coefficients.
一种图像处解密装置,包括:An image decryption device, comprising:
图像接收模块,用于接收加密的图像;An image receiving module, configured to receive encrypted images;
系数获取模块,用于获取所述图像的低频系数;A coefficient acquisition module, configured to acquire low-frequency coefficients of the image;
系数分组模块,用于将所述低频系数分为至少两组系数;a coefficient grouping module, configured to divide the low-frequency coefficients into at least two groups of coefficients;
解密模块,用于从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行解密。A decryption module, configured to select at least one set of coefficients from the at least two sets of coefficients, and decrypt the selected at least one set of coefficients.
本发明实施例提供的图像处理方法、装置,通过将图像的低频系数分成至少两组,选取至少一组系数进行加密,克服现有技术中因加密的系数固定且公开,造成保密性差的问题。The image processing method and device provided by the embodiments of the present invention divide the low-frequency coefficients of the image into at least two groups, select at least one group of coefficients for encryption, and overcome the problem of poor confidentiality caused by the fixed and public encrypted coefficients in the prior art.
附图说明 Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1为本发明实施例图像加密方法的流程示意图;Fig. 1 is a schematic flow chart of an image encryption method according to an embodiment of the present invention;
图2为图1中步骤102的流程示意图;FIG. 2 is a schematic flow chart of
图3为图1中步骤104的流程示意图;FIG. 3 is a schematic flow chart of
图4为本发明实施例图像解密方法的流程示意图;FIG. 4 is a schematic flow diagram of an image decryption method according to an embodiment of the present invention;
图5为图4中步骤403的流程示意图;FIG. 5 is a schematic flow chart of
图6为图4中步骤405的流程图;FIG. 6 is a flowchart of
图7为本发明实施例图像加密装置的结构示意图;7 is a schematic structural diagram of an image encryption device according to an embodiment of the present invention;
图8为本发明实施例图像解密装置结的构示意图;Fig. 8 is a schematic structural diagram of an image decryption device according to an embodiment of the present invention;
图9为本发明实施例小波变换的低频系数分组示意图;Fig. 9 is a schematic diagram of grouping low-frequency coefficients of wavelet transform according to an embodiment of the present invention;
图10为本发明实施例水印嵌入时的系数量化原理示意图;FIG. 10 is a schematic diagram of the coefficient quantization principle when embedding a watermark according to an embodiment of the present invention;
图11为本发明实施例重复水印嵌入示意图;FIG. 11 is a schematic diagram of repeated watermark embedding according to an embodiment of the present invention;
图12(a)是原始Lena图像;Figure 12(a) is the original Lena image;
图12(b)是加密和嵌入水印的Lena图像;Figure 12(b) is the encrypted and watermarked Lena image;
图12(c)是解密和含有水印的Lena图像;Figure 12(c) is the decrypted and watermarked Lena image;
图13(a)是原始cameraman图像;Figure 13(a) is the original cameraman image;
图13(b)是加密和嵌入水印的cameraman图像;Figure 13(b) is the encrypted and watermarked cameraman image;
图13(c)是解密和含有水印的cameraman图像。Figure 13(c) is the decrypted and watermarked cameraman image.
具体实施方式 Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
下面对本发明实施例中一种图像处理方法进行详细介绍,参见图1,方法包括:An image processing method in the embodiment of the present invention is described in detail below, referring to Fig. 1, the method includes:
101、获取图像的低频系数101. Obtain the low frequency coefficient of the image
本例中,对等待发送的图像进行3级小波变换,获取图像小波变换的低频系数{a1,a2,a3,a4,a5,a6.......an}。In this example, perform 3-level wavelet transform on the image waiting to be sent, and obtain the low-frequency coefficients {a 1 , a 2 , a 3 , a 4 , a 5 , a 6 .......a n } of the image wavelet transform .
102、将所述低频系数分为至少两组系数:102. Divide the low-frequency coefficients into at least two groups of coefficients:
将所述低频系数按一定规则分成至少两组系数,如图2所示,该步骤包括:The low-frequency coefficients are divided into at least two groups of coefficients according to certain rules, as shown in Figure 2, this step includes:
201、通过密钥随机产生二进制数201. Randomly generate binary numbers through keys
本例中,密钥随机产生与所述的低频系数个数相同的二进制数 In this example, the key randomly generates binary numbers with the same number of low-frequency coefficients as
202、将所述低频系数与所述二进制数进行比较202. Compare the low frequency coefficient with the binary number
本例中,将所述低频系数与对应位置的二进制数作比较:In this example, the low-frequency coefficients are compared with the binary numbers in the corresponding positions:
a1 a2 a3 a4 a5 a6...... an a 1 a 2 a 3 a 4 a 5 a 6 ...... a n
0 1 0 1 1 0...... 10 1 0 1 1 0... 1
203、按照所述二进制数“0”和“1”的位置所对应的低频系数,将所述低频系数分成系数“0”组、系数“1”组203. According to the low-frequency coefficients corresponding to the positions of the binary numbers "0" and "1", divide the low-frequency coefficients into a coefficient "0" group and a coefficient "1" group
本例中,a1,a3,a6……对应位置的二进制数为“0”,则a1,a3,a6……被分到系数“0”组;In this example, a 1 , a 3 , a 6 ... the binary number at the corresponding position is "0", then a 1 , a 3 , a 6 ... are divided into the coefficient "0"group;
a2,a4,a5……an对应位置的二进制数为“1”,则a2,a4,a5……an被分到系数“1”组。a 2 , a 4 , a 5 ... a n correspond to a binary number of "1", then a 2 , a 4 , a 5 ... a n are divided into the coefficient "1" group.
204、系数“0”组为第一组系数,系数“1”组为第二组系数204. The coefficient "0" group is the first group of coefficients, and the coefficient "1" group is the second group of coefficients
本例中,令系数“0”组为第一组系数,系数“1”组为第二组系数,则第一组系数为{a1,a3,a6……};第二组系数为{a2,a4,a5……an}。In this example, let the coefficient "0" group be the first group of coefficients, and the coefficient "1" group be the second group of coefficients, then the first group of coefficients is {a 1 , a 3 , a 6 ...}; the second group of coefficients It is {a 2 , a 4 , a 5 ... a n }.
103、选取至少一组系数进行加密;103. Select at least one set of coefficients for encryption;
对图像有以下两种处理方式,分别为There are two ways to process images as follows:
(1)嵌入水印并加密图像(1) Embed watermark and encrypt image
选取至少一组系数,对所选取的至少一组系数加密并嵌入水印;或selecting at least one set of coefficients, encrypting and embedding a watermark on the at least one selected set of coefficients; or
选取至少一组系数,对所选取的至少一组系数加密,同时选取另外至少一组系数,在选取的至少一组系数中嵌入水印。Selecting at least one group of coefficients, encrypting the at least one group of selected coefficients, and simultaneously selecting at least another group of coefficients, and embedding a watermark in the selected at least one group of coefficients.
(2)只加密图像(2) Only encrypt the image
随机选取至少一组系数,对所选取的至少一组系数进行加密。Randomly select at least one group of coefficients, and encrypt the selected at least one group of coefficients.
本例中,对图像的处理方式为第一种方式。对第一组系数{a1,a3,a6…}嵌入水印,对第二组系数{a2,a4,a5……}进行DES(Data Encryption Standard,数据加密标准)加密。In this example, the image processing method is the first method. Embed watermarks on the first set of coefficients {a 1 , a 3 , a 6 ...}, and perform DES (Data Encryption Standard) encryption on the second set of coefficients {a 2 , a 4 , a 5 ...}.
对系数{a1,a3,a6…}嵌入水印后,系数变为 After embedding the watermark on the coefficients {a 1 , a 3 , a 6 ...}, the coefficients become
对系数{a2,a4,a5……an}加密后,系数变为 After encrypting the coefficients {a 2 , a 4 , a 5 ... a n }, the coefficients become
104、获取加密后的图像,具体过程参见图3:104. Obtain the encrypted image, see Figure 3 for the specific process:
301、在加密处理完成后,按照所述二进制数的“0”和“1”的位置,合并所述的第一组系数和第二组系数,得到合并后的低频系数;301. After the encryption process is completed, merge the first group of coefficients and the second group of coefficients according to the positions of "0" and "1" of the binary number to obtain the combined low-frequency coefficients;
本例中,按照所述二进制数的“0”的位置,将第一组系数还原到原来的位置;按照所述二进制数的“1”的位置,将第二组系数还原到原来的位置。得到合并后的低频系数。In this example, restore the first group of coefficients to their original positions according to the position of "0" in the binary number; restore the second group of coefficients to their original positions according to the position of "1" in the binary number. The combined low-frequency coefficients are obtained.
按照二进制数的“0”的位置,将第一组系数为还原到原来的位置,按照所述二进制数的“1”的位置,将第二组系数为还原到原来的位置,得到合并后的低频系数为
302、对所述合并后的低频系数进行小波逆变换,得到加密后的图像。302. Perform wavelet inverse transform on the combined low-frequency coefficients to obtain an encrypted image.
本例中,对所述低频系数
本发明实施例提供的方法基于小波变换,取低频系数随机分区,一部分用于加密,一部分用于嵌入水印,算法安全性较高,同时小波变换的低频子带集中图像的主要能量,加密低频子带能达到更好的置乱效果。The method provided by the embodiment of the present invention is based on wavelet transform, and low-frequency coefficients are randomly partitioned, part of which is used for encryption and part of which is used for embedding watermarks. Band can achieve better scrambling effect.
下面对本发明实施例中图像解密方法进行详细介绍,如图4所示,包括:The image decryption method in the embodiment of the present invention is described in detail below, as shown in Figure 4, including:
401、接收加密的图像;401. Receive an encrypted image;
402、将加密的图像进行3级小波变换;402. Perform level 3 wavelet transform on the encrypted image;
本例中,接收端对嵌入水印和加密的图像进行3级小波变换,得到低频系数
403、将所述低频系数分为至少两组系数,具体过程参见图5:403. Divide the low-frequency coefficients into at least two groups of coefficients, see FIG. 5 for the specific process:
使用与相同的规则将所述低频系数分为至少两组系数。The low-frequency coefficients are divided into at least two groups of coefficients using the same rules as .
如图5所示,步骤403包括:As shown in Figure 5,
501、通过密钥随机产生二进制数501. Randomly generate binary numbers through keys
本例中,接收端通过使用与发送端相同的密钥随机产生与所述的低频系数个数相同的二进制数 In this example, the receiving end uses the same key as the sending end to randomly generate binary numbers with the same number of low-frequency coefficients
502、将所述低频系数与所述二进制数进行比较502. Compare the low frequency coefficient with the binary number
本例中,将所述低频系数与对应位置的二进制数作比较:In this example, the low-frequency coefficients are compared with the binary numbers in the corresponding positions:
0 1 0 1 1 0...... 10 1 0 1 1 0... 1
503、按照所述二进制数“0”和“1”的位置所对应的低频系数,将所述低频系数分成系数“0”组、系数“1”组503. According to the low-frequency coefficients corresponding to the positions of the binary numbers "0" and "1", divide the low-frequency coefficients into a coefficient "0" group and a coefficient "1" group
本例中,……对应位置的二进制数为“0”,则……被分到系数“0”组;In this example, ...the binary number at the corresponding position is "0", then ...are assigned to the coefficient "0"group;
对应位置的二进制数为“1”,则被分到系数“1”组。 The binary number at the corresponding position is "1", then are assigned to the coefficient "1" group.
504、系数“0”组为第三组系数,系数“1”组为第四组系数504. The coefficient "0" group is the third group of coefficients, and the coefficient "1" group is the fourth group of coefficients
本例中,令系数“0”组为第三组系数,系数“1”组为第四组系数,则第三组系数为第四组系数为 In this example, let the coefficient "0" group be the third group of coefficients, and the coefficient "1" group be the fourth group of coefficients, then the third group of coefficients is The fourth set of coefficients is
404、分别选取至少一组系数进行解密。404. Select at least one group of coefficients respectively to decrypt.
根据图像在发送端处理方式的不同,可以将接收端对图像处理方式分为两类,分别为:According to the different image processing methods at the sending end, the image processing methods at the receiving end can be divided into two categories, namely:
第一类:接收嵌入水印并加密的图像Type 1: Receive an image embedded with a watermark and encrypted
1)解密图像1) Decrypt the image
选取用于加密的至少一组系数进行解密;Selecting at least one set of coefficients used for encryption for decryption;
2)从图像中提取水印2) Extract the watermark from the image
选取用于嵌入水印的至少一组系数中提取水印;extracting the watermark from at least one set of coefficients selected for embedding the watermark;
3)解密并提取水印3) Decrypt and extract the watermark
选取用于加密的至少一组进行解密并从选取用于嵌入水印的至少一组系数中提取水印。At least one set of coefficients selected for encryption is selected for decryption and the watermark is extracted from at least one set of coefficients selected for embedding the watermark.
第二类:接收仅加密图像Second class: Receive only encrypted images
1)解密;1) Decryption;
选取用于加密的至少一组系数进行解密;Selecting at least one set of coefficients used for encryption for decryption;
2)对选取的加密系数进行解密后,选取至少一组系数,在所选取至少一组系数中嵌入水印,所选取的至少一组系数可以和解密后的系数相同,也可以和解密后的系数不同。2) After decrypting the selected encryption coefficients, select at least one group of coefficients, and embed a watermark in the selected at least one group of coefficients. The selected at least one group of coefficients can be the same as the decrypted coefficients, or can be the same as the decrypted coefficients different.
水印与加密的区域互不影响。图像加密,水印嵌入,图像解密,水印提取,这四个过程是可配置的。为用户提供了多种选择,满足用户不同的需要。即发送端可以选择:1)对图像加密和水印嵌入,得到加密并嵌入水印的图像,2)仅对图像进行加密,得到加密图像。接收端可以选择:1)对加密并嵌入水印的图像进行图像解密和水印提取,得到带水印的解密图像和水印,2)对加密并嵌入水印的图像仅进行图像解密,得到带水印的解密图像,3)对加密并嵌入水印的图像仅进行水印的提取,得到水印,4)对发送端仅仅进行了加密的图像解密并加水印,得到带水印的解密图像。5)对发送端仅仅进行了加密的图像嵌入水印,得到加密并嵌入水印的图像。Watermarks and encrypted areas do not affect each other. Image encryption, watermark embedding, image decryption, watermark extraction, these four processes are configurable. Provide users with a variety of options to meet the different needs of users. That is, the sender can choose: 1) encrypt the image and embed the watermark to obtain an encrypted and embedded watermark image, or 2) only encrypt the image to obtain an encrypted image. The receiver can choose: 1) Decrypt and extract the watermarked image to obtain the decrypted image with watermark and watermark; 2) only decrypt the image encrypted and embedded with watermark to obtain the decrypted image with watermark , 3) Only extract the watermark from the encrypted and watermarked image to obtain the watermark, 4) Decrypt and add the watermark to the encrypted image at the sending end to obtain the decrypted image with the watermark. 5) Embedding a watermark into the image that has only been encrypted at the sending end to obtain an encrypted image with a watermark embedded in it.
本例中,接收到嵌入水印并加密的图像,对所述图像处理的方式为第一类的第三种方式。从第一组系数中提取水印,对第二组系数
从系数
对系数
405、获取解密后的图像,具体过程参见图6:405. Obtain the decrypted image, see Figure 6 for the specific process:
601、在解密、提取水印处理后,按照所述二进制数的“0”和“1”的位置,合并所述的第三组系数和第四组系数,得到合并后的低频系数;601. After decrypting and extracting the watermark, combine the third group of coefficients and the fourth group of coefficients according to the positions of "0" and "1" of the binary number to obtain combined low-frequency coefficients;
本例中,按照所述二进制数的“0”的位置,将第三组系数还原到原来的位置;按照所述二进制数的“1”的位置,将第四组系数还原到原来的位置。得到合并后的低频系数。In this example, the third group of coefficients are restored to their original positions according to the position of "0" in the binary number; and the fourth group of coefficients are restored to their original positions according to the position of "1" in the binary number. The combined low-frequency coefficients are obtained.
按照二进制数为的“0”的位置,将第三组系数为{a1,a3,a6……},还原到原来的位置,按照所述二进制数的“1”的位置,将第四组系数为{a2,a4,a5……an}还原到原来的位置,得到合并后的低频系数为{a1,a2,a3,a4,a5,a6.......an}。According to the binary number as The "0" position of the third group of coefficients is {a 1 , a 3 , a 6 ...}, restored to the original position, according to the binary number The "1" position of the fourth group of coefficients is restored to the original position as {a 2 , a 4 , a 5 ... a n }, and the combined low-frequency coefficients are {a 1 , a 2 , a 3 , a 4 , a 5 , a 6 ...... a n }.
602、对所述合并后的低频系数进行小波逆变换,得到解密并提取水印后的图像。602. Perform wavelet inverse transform on the combined low-frequency coefficients to obtain an image after decryption and watermark extraction.
本例中,对所述低频系数{a1,a2,a3.......an}进行小波逆变换,得到带有水印的解密图像。In this example, wavelet inverse transform is performed on the low-frequency coefficients {a 1 , a 2 , a 3 . . . a n } to obtain a decrypted image with a watermark.
本发明实施例提供的方法通过密钥将图像的低频系数随机分配后,可以得到解密并带有水印的图像,图像显示效果与原图无明显差异,同时达到了保护版权的目的。The method provided by the embodiment of the present invention randomly distributes the low-frequency coefficients of the image through a key, and then a decrypted image with a watermark can be obtained, and the display effect of the image has no obvious difference from the original image, and at the same time, the purpose of copyright protection is achieved.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.
下面对本发明实施例提供的一种图像处理装置进行详细介绍,所述装置适用于对图像加密或加密并嵌入水印,参见图10:An image processing device provided by an embodiment of the present invention is described in detail below, the device is suitable for encrypting an image or encrypting and embedding a watermark, see Figure 10:
一种图像加密的装置,包括:An image encryption device, comprising:
系数获取模块701,用于获取图像的低频系数;A
系数分组模块702,用于将所述低频系数分为至少两组系数;A
加密模块703,用于从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行加密。An
所述图像处理装置,还包括:The image processing device also includes:
嵌入水印模块705,用于从所述至少两组系数中选取至少一组系数,在所述选取的至少一组系数中嵌入水印。The embedding
所述系数分组模块702可以进一步包括:The
二进制数获取单元706,用于通过密钥随机产生二进制数;Binary
比较单元707,用于将所述低频系数与所述二进制数进行比较;A comparing
分组单元708,用于按照所述二进制数“0”和“1”的位置所对应的低频系数,将所述低频系数分成系数“0”组、系数“1”组。The
所述系数获取模块用于对所述图像进行小波变换,获得小波变换后的低频系数,所述装置还包括:The coefficient acquisition module is used to perform wavelet transformation on the image to obtain low-frequency coefficients after wavelet transformation, and the device also includes:
系数合并模块709,用于按照所述二进制数的“0”和“1”的位置,合并系数“0”组、系数“1”组,得到合并后的低频系数;The
逆变换模块710,用于对所述合并后的低频系数进行小波逆变换,得到加密后的图像。The
下面对本发明实施例提供的图像图像装置进行详细介绍,所述装置适用于对图像解密或解密并提取水印,参见图11:The image device provided by the embodiment of the present invention is described in detail below, and the device is suitable for decrypting an image or decrypting and extracting a watermark, see FIG. 11 :
图像接收模块801,用于接收加密的图像;An image receiving module 801, configured to receive encrypted images;
系数获取模块802,用于获取所述图像的低频系数;A coefficient acquisition module 802, configured to acquire low-frequency coefficients of the image;
系数分组模块803,用于将所述低频系数分为至少两组系数;A coefficient grouping module 803, configured to divide the low-frequency coefficients into at least two groups of coefficients;
解密模块804,用于从所述至少两组系数中选取至少一组系数,对所述选取的至少一组系数进行解密。A decryption module 804, configured to select at least one set of coefficients from the at least two sets of coefficients, and decrypt the selected at least one set of coefficients.
所述图像处理装置,还包括:The image processing device also includes:
提取水印模块806,用于从所述至少两组系数中选取至少一组系数,在所述选取的至少一组系数中提取水印。Extracting a watermark module 806, configured to select at least one set of coefficients from the at least two sets of coefficients, and extract a watermark from the selected at least one set of coefficients.
所述系数分组模块803可以进一步包括:The coefficient grouping module 803 may further include:
二进制数获取单元807,用于通过密钥随机产生二进制数;Binary number acquisition unit 807, for randomly generating binary numbers through the key;
比较单元808,用于将所述低频系数与所述二进制数进行比较;A comparing unit 808, configured to compare the low-frequency coefficients with the binary number;
分组单元809,用于按照所述二进制数“0”和“1”的位置所对应的低频系数,将所述低频系数分成系数“0”组、系数“1”组。The grouping unit 809 is configured to divide the low-frequency coefficients into a coefficient "0" group and a coefficient "1" group according to the low-frequency coefficients corresponding to the positions of the binary numbers "0" and "1".
所述系数获取模块802用于对所述图像进行小波变换,获得小波变换后的低频系数,所述装置还包括:The coefficient acquisition module 802 is used to perform wavelet transformation on the image to obtain low-frequency coefficients after wavelet transformation, and the device also includes:
系数合并模块810,用于按照所述二进制数的“0”和“1”的位置,合并所述的系数“0”组、系数“1”组,得到合并后的低频系数;The coefficient merging module 810 is configured to merge the coefficient "0" group and the coefficient "1" group according to the positions of "0" and "1" of the binary number to obtain the combined low-frequency coefficients;
逆变换模块811,用于对所述低频系数进行小波逆变换,得到解密后的图像。The inverse transform module 811 is configured to perform wavelet inverse transform on the low-frequency coefficients to obtain a decrypted image.
本发明实施例提供的图像加密装置通过将图像的低频系数划分为至少两组,选择其中至少一组用于加密,使得加密区域不是固定的,提高了图像传输的安全性;同时还可以对图像即加密,又选择至少一组嵌入水印,即将加密和水印进行联合使图像得到传输和版权的双重保护。通过图像解密可以进行解密和或提取水印。The image encryption device provided by the embodiment of the present invention divides the low-frequency coefficients of the image into at least two groups, and selects at least one group for encryption, so that the encryption area is not fixed, which improves the security of image transmission; That is to encrypt, and select at least one set of embedded watermarks, that is, to combine encryption and watermarks so that the image can be protected by both transmission and copyright. Decryption and/or watermark extraction can be performed by image decryption.
下面以应用实例介绍嵌入水印和提取水印的过程。The process of embedding watermark and extracting watermark is introduced below with application examples.
在发送端得到加密并嵌入水印图像的具体步骤如下:1)对原始图像f(x,y)进行3级2-D DWT(Discrete Wavelet Transform),抽取DWT低频子带系数;2)通过密钥Key0随机地将低频系数分为不相关的两部分S1和S2;3)其中S1区域用于嵌入水印W,生成S1’,S2区域用于DES加密,生成S2’;4)将S1’和S2’合成,通过小波逆变换得到加密并嵌入水印的图像f’(x,y);The specific steps of encrypting and embedding the watermarked image at the sending end are as follows: 1) Perform 3-level 2-D DWT (Discrete Wavelet Transform) on the original image f(x, y) to extract DWT low-frequency sub-band coefficients; 2) pass the key Key0 randomly divides the low-frequency coefficients into two irrelevant parts S1 and S2; 3) The S1 area is used to embed the watermark W to generate S1', and the S2 area is used for DES encryption to generate S2'; 4) The S1' and S2 'Synthesis, the image f'(x, y) that is encrypted and embedded with a watermark is obtained through wavelet inverse transformation;
在接收端得到带水印的解密图像和水印的步骤如下:1)对待处理图像f’(x,y)进行3级2-D DWT(Discrete Wavelet Transform),抽取DWT低频子带系数;2)通过密钥Key0随机地将低频系数分为不相关的两部分S1’和S2’;3)其中S1’区域用于提取水印W,S2’区域用于DES解密,生成S2;4)将S1’和S2合成,通过小波逆变换得到带水印的解密图像f”(x,y)。下面对小波系数分组、水印嵌入和水印提取进行详细介绍:The steps to obtain the decrypted image with watermark and watermark at the receiving end are as follows: 1) Perform 3-level 2-D DWT (Discrete Wavelet Transform) on the image f'(x, y) to be processed, and extract the DWT low-frequency subband coefficients; 2) pass The key Key0 randomly divides the low-frequency coefficients into two irrelevant parts S1' and S2'; 3) The S1' area is used to extract the watermark W, and the S2' area is used for DES decryption to generate S2; 4) The S1' and S2 synthesis, the decrypted image f"(x, y) with watermark is obtained through wavelet inverse transformation. The following is a detailed introduction to wavelet coefficient grouping, watermark embedding and watermark extraction:
A、小波变换的低频系数分组A. Grouping of low-frequency coefficients of wavelet transform
首先对大小为256*256的原始灰度图像进行三层正交小波分解。设LL3为低频子带,HLi,LHi,HHi(i=1,2,3)分别为其水平、垂直和对角中高频子带。由密钥Key0产生随机二进制数组A,大小与LL3相同。通过与低频系数LL3比较,在A数组元素值为‘1’的位置,将LL3中对应位置的值拿出作为S1区;在A数组元素值为‘0’的位置,将LL3中对应位置的值拿出作为S2区。如图9所示:Firstly, three-layer orthogonal wavelet decomposition is performed on the original grayscale image with a size of 256*256. Let LL 3 be the low frequency sub-band, HL i , LH i , HH i (i=1, 2, 3) be the horizontal, vertical and diagonal middle and high frequency sub-bands respectively. A random binary array A is generated from the key Key0, the size of which is the same as LL3 . By comparing with the low-frequency coefficient LL 3 , at the position where the element value of the A array is '1', the value of the corresponding position in LL 3 is taken out as the S1 area; at the position where the element value of the A array is ' 0 ', the The value of the corresponding position is taken out as the S2 area. As shown in Figure 9:
B、水印嵌入过程B. Watermark embedding process
S1区域待嵌入的系数为E,嵌入之后为E1;嵌入水印为W;量化步长为Q,取Q=20。The coefficient to be embedded in the S1 area is E, which is E1 after embedding; the embedded watermark is W; the quantization step is Q, and Q=20.
图10为量化原理图示意图:Figure 10 is a schematic diagram of the quantization principle:
1)按量化步长Q将坐标轴分为,上图所示的M区间集和N区间集。1) According to the quantization step size Q, the coordinate axis is divided into the M interval set and the N interval set shown in the above figure.
2)坐标轴的实际值代表了待嵌入系数E的数值,同时坐标轴上M区间集都代表二进制水印‘1’,坐标轴N区间集都代表了二进制水印‘0’。2) The actual value of the coordinate axis represents the value of the coefficient E to be embedded. At the same time, the M interval sets on the coordinate axis all represent the binary watermark '1', and the N interval sets on the coordinate axis all represent the binary watermark '0'.
3)对待量化系数E取整数商和取余数运算:rem=E-fix*Q3) Take the integer quotient and remainder operation of the quantized coefficient E: rem=E-fix*Q
4)根据待量化的系数E所在区间集和水印W,对E进行量化处理:当W=1时,使量化结果E1为与E最接近的M区间集中的中间坐标值;当W=0时,使E1为与E最接近的N区间集中的中间坐标值。4) According to the interval set where the coefficient E to be quantized is located and the watermark W, quantize E: when W=1, make the quantization result E1 the intermediate coordinate value in the M interval set closest to E; when W=0 , let E1 be the intermediate coordinate value in the N interval set closest to E.
量化的处理过程可表示如下:The quantization process can be expressed as follows:
(1)当fix=0且W=1时 E1=Q/2(1) When fix=0 and W=1 E1=Q/2
(2)当fix=0且W=0时 E1=3Q/2(2) When fix=0 and W=0, E1=3Q/2
(3)当fix≠0且W=1时(3) When fix≠0 and W=1
(4)当fix≠0且W=0时(4) When fix≠0 and W=0
(5)重复水印嵌入:嵌入水印W中的一个比特对应E中的连续三个比特,如图11所示,若当前待嵌入水印比特为“1”,则实际嵌入水印为“111”;若当前待嵌入水印比特为“0”,则实际嵌入水印为“000”。(5) Repeated watermark embedding: one bit embedded in watermark W corresponds to three consecutive bits in E, as shown in Figure 11, if the current watermark bit to be embedded is "1", the actual embedded watermark is "111"; if If the bit of the watermark to be embedded is currently "0", the actual embedded watermark is "000".
本实施例以大小为256*256的灰度图像为例,经密钥Key0产生随机二进制数组选取,区域E的大小是大约500比特,故可嵌入水印166比特。In this embodiment, a grayscale image with a size of 256*256 is taken as an example. The random binary array generated by the key Key0 is selected. The size of the area E is about 500 bits, so a 166-bit watermark can be embedded.
C、水印提取过程C. Watermark extraction process
对加密并嵌入水印的灰度图像进行三层正交小波分解,LL3为低频子带。仍然由密钥Key0产生随机二进制数组A,大小与LL3′相同。通过与低频系数LL3′比较,在A数组元素值为‘1’的位置,将LL3′中对应位置的值拿出作为S1′区;在A数组元素值为‘0’的位置,将LL3′中对应位置的值拿出作为S2′区。A three-level orthogonal wavelet decomposition is performed on the encrypted and watermarked grayscale image, and LL3 is the low frequency subband. A random binary array A is still generated from the key Key0, the size of which is the same as LL 3 '. By comparing with the low-frequency coefficient LL 3 ', at the position where the element value of the A array is '1', take out the value of the corresponding position in LL 3 ' as the S1'area; at the position where the element value of the A array is '0', set The value of the corresponding position in LL 3 ' is taken out as the S2' area.
取出S1′区域,水印信息是由判断其幅度值E1′来决定,如果属于M区域,则提取二进制水印‘1’,如果属于N区域,则提取二进制水印‘0’,表达式如下:Take out the S1' area, the watermark information is determined by judging its amplitude value E1', if it belongs to the M area, then extract the binary watermark '1', if it belongs to the N area, then extract the binary watermark '0', the expression is as follows:
由于本方法还采用了重复嵌入,可经选举过程确定出完整的水印,较大地提高了正确提取水印的概率。Because this method also uses repeated embedding, the complete watermark can be determined through the election process, which greatly improves the probability of correctly extracting the watermark.
现给出lena和cameraman这两个具有代表性的图像做实验的测试结果。The test results of the experiment with two representative images of lena and cameraman are given here.
图12显示用本发明实施例方法对图像Lena嵌入水印和加密的结果。图15(a)是原始Lena图像,图15(b)是加密和嵌入水印的Lena图像,由图可知,加密图像与原图在视觉上有很好的置乱效果,图15(c)是解密和含有水印的Lena图像,由图可知解密后仍含有水印的图像与原始图像无明显差异。Fig. 12 shows the result of embedding watermark and encrypting the image Lena with the method of the embodiment of the present invention. Figure 15(a) is the original Lena image, and Figure 15(b) is the encrypted and watermarked Lena image. It can be seen from the figure that the encrypted image and the original image have a good visual scrambling effect, and Figure 15(c) is Decrypted and watermarked Lena image, it can be seen from the figure that there is no obvious difference between the decrypted image and the original image that still contains the watermark.
图13显示用本发明方法对图像cameraman嵌入水印和加密的结果。图16(a)是原始cameraman图像,图16(b)是加密和嵌入水印的cameraman图像,由图可知,加密图像与原图在视觉上有很好的置乱效果,图16(c)是解密和含有水印的cameraman图像,由图可知解密后仍含有水印的图像与原始图像无明显差异。Fig. 13 shows the result of using the method of the present invention to embed watermark and encrypt the image cameraman. Figure 16(a) is the original cameraman image, and Figure 16(b) is the encrypted and watermarked cameraman image. It can be seen from the figure that the encrypted image and the original image have a good visual scrambling effect, and Figure 16(c) is Decrypted and watermarked cameraman images, it can be seen from the figure that there is no significant difference between the decrypted image and the original image that still contains the watermark.
在本发明实施例中,以小波变换为例进行介绍的,实际上本发明还可以适用于其他变换,例如DCT变换等。以DCT变换为例,图像经过DCT变换后,分别得到直流系数和交流系数,直流系数属于低频系数,交流系数中包括高频系数和低频系数,采用本发明的方法,可以将所有低频系数分成至少两组,同样的确定其中的两组分别为水印嵌入区域和加密区域,分别用于嵌入水印和加密。在对对象进行嵌入水印或加密处理后,在进行反DCT变换获得处理后的图像。在接收端,处理方法与前面实施例描述的类似,不再赘述。同时,本发明的思想同样可用于音频、视频领域。In the embodiment of the present invention, wavelet transform is used as an example for introduction, but in fact, the present invention can also be applied to other transforms, such as DCT transform. Taking DCT transformation as an example, after the image is transformed by DCT, DC coefficients and AC coefficients are obtained respectively. Two groups, the same two groups are determined as the watermark embedding area and the encryption area, which are used for watermark embedding and encryption respectively. After embedding the watermark or encrypting the object, the processed image is obtained by inverse DCT transformation. At the receiving end, the processing method is similar to that described in the previous embodiments and will not be repeated here. At the same time, the idea of the present invention can also be used in audio and video fields.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims (16)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2008101688530A CN101394553B (en) | 2008-09-28 | 2008-09-28 | Image encryption and decryption method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2008101688530A CN101394553B (en) | 2008-09-28 | 2008-09-28 | Image encryption and decryption method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101394553A true CN101394553A (en) | 2009-03-25 |
CN101394553B CN101394553B (en) | 2010-12-08 |
Family
ID=40494586
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2008101688530A Expired - Fee Related CN101394553B (en) | 2008-09-28 | 2008-09-28 | Image encryption and decryption method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101394553B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103618599A (en) * | 2013-12-04 | 2014-03-05 | 重庆大学 | Method for processing data set before encryption |
CN102415087B (en) * | 2009-05-11 | 2014-09-03 | 富士通株式会社 | Image encryption/decoding device, method, and program |
CN107146192A (en) * | 2017-05-02 | 2017-09-08 | 湖北工程学院 | Image security protection method and device |
-
2008
- 2008-09-28 CN CN2008101688530A patent/CN101394553B/en not_active Expired - Fee Related
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102415087B (en) * | 2009-05-11 | 2014-09-03 | 富士通株式会社 | Image encryption/decoding device, method, and program |
US8935536B2 (en) | 2009-05-11 | 2015-01-13 | Fujitsu Limited | Image encryption/decryption device, method, and storage medium storing a program |
CN103618599A (en) * | 2013-12-04 | 2014-03-05 | 重庆大学 | Method for processing data set before encryption |
CN103618599B (en) * | 2013-12-04 | 2016-09-14 | 重庆大学 | Data set encryption pre-treating method |
CN107146192A (en) * | 2017-05-02 | 2017-09-08 | 湖北工程学院 | Image security protection method and device |
Also Published As
Publication number | Publication date |
---|---|
CN101394553B (en) | 2010-12-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Wang | Steganography of capacity required using modulo operator for embedding secret image | |
Lin et al. | Wavelet-based copyright-protection scheme for digital images based on local features | |
Lin et al. | Public-key-based optical image cryptosystem based on data embedding techniques | |
Patel et al. | Secure and authentic DCT image steganography through DWT-SVD based digital watermarking with RSA encryption | |
Houssein et al. | An image steganography algorithm using haar discrete wavelet transform with advanced encryption system | |
Adi et al. | High quality image steganography on integer Haar Wavelet Transform using modulus function | |
Joshi et al. | Image steganography combination of spatial and frequency domain | |
Pal et al. | Study on watermarking techniques in digital images | |
CN110211018B (en) | Chaos encryption reversible information hiding method based on odd-even discrimination strategy | |
Mostaghim et al. | CVC: Chaotic visual cryptography to enhance steganography | |
CN111984943B (en) | A DWT-SVD Digital Watermarking Method Based on Artificial Bee Colony Algorithm | |
Devi et al. | A copyright protection scheme for digital images based on shuffled singular value decomposition and visual cryptography | |
CN101394553A (en) | Image encryption and decryption method and device | |
Sun et al. | A Novel Image Steganography Based on Contourlet Transform and Hill Cipher. | |
Kalaivani et al. | Survey on multimedia data security | |
Mohamed et al. | Hybrid watermarking scheme for copyright protection using chaotic maps cryptography | |
Alam et al. | Analysis of modified triple—A steganography technique using Fisher Yates algorithm | |
Jawad et al. | A survey on emerging challenges in selective color image encryption techniques | |
Agarwal et al. | Robust and secure watermarking for propagation of digital multimedia by paillier homomorphic cryptosystem with arnold transformation | |
Alfadhli et al. | Enhancing standard encryption algorithms using multilayers encryption technique | |
CN103957099A (en) | Media encryption and decryption method combined with watermark | |
Ayyappan et al. | A review on reversible data hiding techniques | |
Lu et al. | Chaos-based spread spectrum robust watermarking in DWT domain | |
Battisti et al. | Watermarking and encryption of color images in the Fibonacci domain | |
Priyanka et al. | A steganographic system for embedding image and encrypted text |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20101208 Termination date: 20140928 |
|
EXPY | Termination of patent right or utility model |