[go: up one dir, main page]

CN109657483B - Image encryption method and system - Google Patents

Image encryption method and system Download PDF

Info

Publication number
CN109657483B
CN109657483B CN201811429064.8A CN201811429064A CN109657483B CN 109657483 B CN109657483 B CN 109657483B CN 201811429064 A CN201811429064 A CN 201811429064A CN 109657483 B CN109657483 B CN 109657483B
Authority
CN
China
Prior art keywords
matrix
image
area
row
layer
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
CN201811429064.8A
Other languages
Chinese (zh)
Other versions
CN109657483A (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.)
Harbin Institute of Technology Shenzhen
Original Assignee
Harbin Institute of Technology Shenzhen
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 Harbin Institute of Technology Shenzhen filed Critical Harbin Institute of Technology Shenzhen
Priority to CN201811429064.8A priority Critical patent/CN109657483B/en
Publication of CN109657483A publication Critical patent/CN109657483A/en
Application granted granted Critical
Publication of CN109657483B publication Critical patent/CN109657483B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/001Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Image Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses an image encryption method and system, comprising the following steps: s1, marking the size of the to-be-processed area of the to-be-processed image as M multiplied by N, and outputting a three-dimensional matrix E; s2, randomly generating a matrix RA, acquiring an index matrix RO, randomly generating a matrix PA, and acquiring an index matrix PO; s3, generating a matrix TA; s4, selecting the coordinate (RO) in the matrix E layer by layer and line by liner,n,n,POn,p) As the parameter to be transformed; s5, the coordinates in the matrix TA are (RO) layer by layer and line by liner,n,n,POn,p) The values of (a) are ordered to obtain a vector V, and the parameters to be transformed are processed based on the vector V to obtain a scrambling matrix D; s6, exclusive-or scrambling the matrix D to obtain the encrypted image. The system is used for executing the method. The encryption range is determined according to the data volume of the bit plane, the encryption processing is realized by the replacement of pixels, the encryption safety is increased by the exclusive OR of rows, columns and layers, and the processing can be performed aiming at key areas so as to obtain the ideal encryption effect aiming at the image with high bits.

Description

一种图像加密方法和系统An image encryption method and system

技术领域technical field

本发明涉及图像加密技术领域,尤其是一种图像加密方法和系统。The invention relates to the technical field of image encryption, in particular to an image encryption method and system.

背景技术Background technique

多媒体的蓬勃发展使得互联网中图像、音乐、视频等多媒体数据急剧增长。数字图像是互联网中最常见的一种多媒体数据形式,具有生动直观,信息丰富等特点。因而是人们传递信息的主要形式之一。在这些海量的数字图像中,很多图像是私密图像,如一些军事、医疗图像等。因此如何确保这些私密图像在互联网中的安全变得十分重要。The vigorous development of multimedia has caused the rapid growth of multimedia data such as images, music, and videos in the Internet. Digital image is the most common form of multimedia data in the Internet, which has the characteristics of vivid, intuitive and rich information. Therefore, it is one of the main forms for people to transmit information. Among these massive digital images, many images are private images, such as some military and medical images. Therefore, how to ensure the security of these private images in the Internet becomes very important.

流行的图像加密方案是把图像数据看成二进制数据,然后使用已有的数据加密技术对图像进行加密。但是这种方案有很多的局限性,虽然从在数据存储格式上看,图像信息和文本信息都是采用二进制流的方式存储,并无实质性区别,但是图像的每个像素通常用8或者更多位来表示,使得图像数据量远远超过文本信息。用传统的文本加密算法来加密图像导致效率不高。另外,图像在颜色、纹理、机构等层面具有很多独有的特征,使得各个数据区域具有很大的相关性和冗余度,而传统的文本加密没有考虑到图像的这些特征,可能会得不到理想的加密结果。A popular image encryption scheme treats image data as binary data, and then encrypts the image using existing data encryption techniques. However, this scheme has many limitations. Although in terms of data storage format, both image information and text information are stored in the form of binary streams, and there is no substantial difference, but each pixel of the image usually uses 8 or more pixels. Multi-bit representation makes the amount of image data far more than text information. Encrypting images with traditional text encryption algorithms results in inefficiencies. In addition, images have many unique features at the level of color, texture, organization, etc., which make each data area have great correlation and redundancy, and traditional text encryption does not consider these features of images, which may result in to the desired encryption result.

发明内容SUMMARY OF THE INVENTION

本发明旨在至少在一定程度上解决相关技术中的技术问题之一。为此,本发明的一个目的是提供一种图像加密方法和系统。The present invention aims to solve one of the technical problems in the related art at least to a certain extent. To this end, an object of the present invention is to provide an image encryption method and system.

本发明所采用的技术方案是:The technical scheme adopted in the present invention is:

一种图像加密方法,包括步骤:S1、根据比特位面分层待处理图像,标记待处理图像的待处理区域的尺寸为M×N,输出对应的三维矩阵E,E的尺寸为M×N×L,其中,L为位面层数;S2、随机生成M×N的矩阵RA,获取对应的索引矩阵RO,随机生成N×L的矩阵PA,获取对应的索引矩阵PO;S3、生成与三维矩阵E尺寸一致的矩阵TA,TAi,j,k=|RAi,j-PAj,k|,其中,i,j,k为三维坐标;S4、逐层、逐行地选择矩阵E中坐标为(ROr,n,n,POn,p)的像素以作为待变换参数,其中,r∈1~M为行索引,p∈1~L为位面层索引,n∈1~N;S5、逐层、逐行地将矩阵TA中坐标为(ROr,n,n,POn,p)的值进行排序以获取向量V,基于所述向量V处理对应的待变换参数以获取置乱矩阵D;S6、异或所述置乱矩阵D以获取被加密的图像。An image encryption method, comprising the steps of: S1, layering images to be processed according to bit planes, marking the size of the to-be-processed area of the to-be-processed image as M×N, and outputting a corresponding three-dimensional matrix E, where the size of E is M×N ×L, where L is the number of bit plane layers; S2, randomly generate an M×N matrix RA, obtain the corresponding index matrix RO, randomly generate an N×L matrix PA, and obtain the corresponding index matrix PO; S3, generate and The three-dimensional matrix E is a matrix TA with the same size, TA i,j,k =|RA i,j -PA j,k |, where i, j, k are three-dimensional coordinates; S4, select the matrix E layer by layer and row by row The pixel whose median coordinate is (RO r,n ,n,PO n,p ) is used as the parameter to be transformed, where r∈1~M is the row index, p∈1~L is the bit plane layer index, n∈1~ N; S5. Sort the values with the coordinates (RO r,n ,n,PO n,p ) in the matrix TA layer by layer and row by row to obtain a vector V, and process the corresponding parameters to be transformed based on the vector V to Obtain a scrambled matrix D; S6, XOR the scrambled matrix D to obtain an encrypted image.

优选的,还包括步骤S0、对初始图像进行预处理,步骤S0包括:对初始图像进行二进制处理以得到边缘图像,利用连通区域函数过滤出符合阈值的第一区域,对第一区域进行形态处理以获得待处理图像。Preferably, the method further includes step S0, preprocessing the initial image, and step S0 includes: performing binary processing on the initial image to obtain an edge image, filtering out a first area that meets the threshold by using a connected area function, and performing morphological processing on the first area to obtain the image to be processed.

优选的,步骤S6具体包括:按照行、列和层的顺序异或所述置乱矩阵D以获取被加密的图像。Preferably, step S6 specifically includes: XORing the scrambled matrix D according to the order of rows, columns and layers to obtain the encrypted image.

优选的,步骤S2具体包括:基于混沌系统或伪随机数生成器生成M×N的矩阵RA和N×L的矩阵PA,然后对PA的每一列进行排序,得到索引矩阵RO,对PA的每一行进行排序,得到索引矩阵PO。Preferably, step S2 specifically includes: generating an M×N matrix RA and an N×L matrix PA based on a chaotic system or a pseudo-random number generator, and then sorting each column of the PA to obtain an index matrix RO, and for each column of the PA One row is sorted to get the index matrix PO.

优选的,对符合阈值的部分进行形态处理具体包括:对第一区域进行腐蚀处理,移除孤立像素,加厚补偿以获得第二区域,第一区域按像素与第二区域,通过求凸包获得第三区域,度量第三区域的属性以获得待处理图像。Preferably, performing morphological processing on the part that meets the threshold specifically includes: performing corrosion processing on the first area, removing isolated pixels, and thickening compensation to obtain the second area, the first area is divided into pixels and the second area, by calculating the convex hull The third region is obtained, and the properties of the third region are measured to obtain the image to be processed.

本发明所采用的技术方案是:The technical scheme adopted in the present invention is:

一种图像加密系统,包括:标记模块,用于根据比特位面分层待处理图像,标记待处理图像的待处理区域的尺寸为M×N,输出对应的三维矩阵E,E的尺寸为M×N×L,其中,L为位面层数;索引模块,用于随机生成M×N的矩阵RA,获取对应的索引矩阵RO,随机生成N×L的矩阵PA,获取对应的索引矩阵PO;重组模块,用于生成与三维矩阵E尺寸一致的矩阵TA,TAi,j,k=|RAi,j-PAj,k|,其中,i,j,k为三维坐标;置乱模块,用于逐层、逐行地选择矩阵E中坐标为(ROr,n,n,POn,p)的像素以作为待变换参数,其中,r∈1~M为行索引,p∈1~L为位面层索引,n∈1~N;置乱模块,还用于逐层、逐行地将矩阵TA中坐标为(ROr,n,n,POn,p)的值进行排序以获取向量V,基于所述向量V处理对应的待变换参数以获取置乱矩阵D;异或模块,用于异或所述置乱矩阵D以获取被加密的图像。An image encryption system, comprising: a marking module for layering images to be processed according to bit planes, marking the size of the to-be-processed area of the to-be-processed image as M×N, and outputting a corresponding three-dimensional matrix E, where the size of E is M ×N×L, where L is the number of bit plane layers; the index module is used to randomly generate an M×N matrix RA, obtain the corresponding index matrix RO, randomly generate an N×L matrix PA, and obtain the corresponding index matrix PO ; The reorganization module is used to generate a matrix TA that is consistent with the size of the three-dimensional matrix E, TA i,j,k =|RA i,j -PA j,k |, wherein, i, j, k are three-dimensional coordinates; scrambling module , which is used to select the pixels whose coordinates are (RO r,n ,n,PO n,p ) in the matrix E layer by layer and row by row as the parameters to be transformed, where r∈1~M is the row index, p∈1 ~L is the bit plane layer index, n∈1~N; the scrambling module is also used to sort the values in the matrix TA whose coordinates are (RO r,n ,n,PO n,p ) layer by layer and row by row To obtain a vector V, the corresponding parameters to be transformed are processed based on the vector V to obtain a scrambled matrix D; an XOR module is used to XOR the scrambled matrix D to obtain an encrypted image.

优选的,还包括:预处理模块,用于对初始图像进行二进制处理以得到边缘图像,利用连通区域函数过滤出符合阈值的第一区域,对第一区域进行形态处理以获得待处理图像。Preferably, it also includes: a preprocessing module for performing binary processing on the initial image to obtain an edge image, filtering out a first region that meets the threshold by using a connected region function, and performing morphological processing on the first region to obtain an image to be processed.

优选的,所述异或模块,具体用于按照行、列和层的顺序异或所述置乱矩阵D以获取被加密的图像。Preferably, the XOR module is specifically configured to XOR the scrambled matrix D in the order of rows, columns and layers to obtain the encrypted image.

优选的,所述索引模块,用于基于混沌系统或伪随机数生成器生成M×N的矩阵RA和N×L的矩阵PA,然后对PA的每一列进行排序,得到索引矩阵RO,对PA的每一行进行排序,得到索引矩阵PO。Preferably, the indexing module is used to generate an M×N matrix RA and an N×L matrix PA based on a chaotic system or a pseudo-random number generator, and then sort each column of the PA to obtain the index matrix RO, and the PA Sort each row of , to get the index matrix PO.

优选的,所述预处理模块对符合阈值的部分进行形态处理具体包括:Preferably, the morphological processing of the part that meets the threshold by the preprocessing module specifically includes:

对第一区域进行腐蚀处理,移除孤立像素,加厚补偿以获得第二区域,第一区域按像素与第二区域,通过求凸包获得第三区域,度量第三区域的属性以获得待处理图像。The first area is eroded, the isolated pixels are removed, the thickness compensation is increased to obtain the second area, the first area is divided into pixels and the second area, the third area is obtained by calculating the convex hull, and the properties of the third area are measured to obtain the desired area. Process images.

本发明的有益效果是:The beneficial effects of the present invention are:

本发明通过根据比特位面的数据量确定加密范围,通过对像素的置换以实现加密化处理,通过对的行、列和层的异或以增加加密安全性,能够针对重点区域进行处理以获得理想的针对于高比特位的图像的加密效果。The invention determines the encryption range according to the data amount of the bit plane, realizes the encryption processing by replacing the pixels, increases the encryption security by the exclusive OR of the rows, columns and layers, and can process the key areas to obtain Ideal for encryption of high-bit images.

附图说明Description of drawings

图1是本发明的一种图像加密方法;Fig. 1 is a kind of image encryption method of the present invention;

图2是本发明的矩阵实例;Fig. 2 is a matrix example of the present invention;

图3是本发明的一种图像加密系统。Fig. 3 is an image encryption system of the present invention.

具体实施方式Detailed ways

需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict.

实施例1Example 1

本实施例的目的在于解释现有技术的缺点并说明本发明的思路。The purpose of this embodiment is to explain the shortcomings of the prior art and to illustrate the idea of the present invention.

比特深度描绘了图像所能达到的细节精度,一般来说,比特深度越深,图像的对比度就越高。由于人眼对颜色深浅的识别程度有限,生活中一般的图像都是8比特深度,然而,在一些特殊的领域,比如医疗,军事等,它们对细节的要求十分苛刻,一般的8比特图像无法满足他们的工作需求,于是高精度的图像随之诞生,例如在医疗领域,X光图片是16比特深度,与普通图像相比,16比特深度的图像包含了更丰富的信息,且它的每个位面所包含的信息量是不同的,最高比特位面的信息含量占总信息的一半,而第9比特位面的信息占比就只有不到1%,因此,对于高精度图像而言,高比特位面(即“bitplane”)的安全性影响着整体的安全性。Bit depth describes the level of detail that an image can achieve. Generally speaking, the deeper the bit depth, the higher the contrast of the image. Due to the limited recognition of color depth by the human eye, the general images in life are 8-bit depth. However, in some special fields, such as medical, military, etc., they have very strict requirements on details, and general 8-bit images cannot be To meet their work needs, high-precision images were born. For example, in the medical field, X-ray pictures are 16-bit depth. Compared with ordinary images, 16-bit depth images contain richer information, and each of its The amount of information contained in each bit plane is different. The information content of the highest bit plane accounts for half of the total information, while the information content of the ninth bit plane accounts for less than 1%. Therefore, for high-precision images , the security of the high bit plane (ie "bitplane") affects the overall security.

本实施例提供如图1所示的一种图像加密方法,包括步骤:S1、根据比特位面分层待处理图像,标记待处理图像的待处理区域的尺寸为M×N,输出对应的三维矩阵E,E的尺寸为M×N×L,其中,L为位面层数;S2、随机生成M×N的矩阵RA,获取对应的索引矩阵RO,随机生成N×L的矩阵PA,获取对应的索引矩阵PO;S3、生成与三维矩阵E尺寸一致的矩阵TA,TAi,j,k=|RAi,j-PAj,k|,其中,i,j,k为三维坐标;S4、逐层、逐行地选择矩阵E中坐标为(ROr,n,n,POn,p)的像素以作为待变换参数,其中,r∈1~M为行索引,p∈1~L为位面层索引,n∈1~N;S5、逐层、逐行地将矩阵TA中坐标为(ROr,n,n,POn,p)的值进行排序以获取向量V,逐层(位面层)、逐行(一行像素)地基于所述向量V处理对应的待变换参数以获取置乱矩阵D;S6、异或所述置乱矩阵D以获取被加密的图像。其中,具体的步骤包括:This embodiment provides an image encryption method as shown in FIG. 1 , including steps: S1. Layer the to-be-processed images according to the bit plane, mark the size of the to-be-processed area of the to-be-processed image as M×N, and output the corresponding three-dimensional The dimensions of the matrices E and E are M×N×L, where L is the number of plane layers; S2, randomly generate an M×N matrix RA, obtain the corresponding index matrix RO, randomly generate an N×L matrix PA, and obtain Corresponding index matrix PO; S3, generate a matrix TA with the same size as the three-dimensional matrix E, TA i,j,k =|RA i,j -PA j,k |, where i,j,k are three-dimensional coordinates; S4 , layer by layer and row by row, select the pixels whose coordinates are (RO r,n ,n,PO n,p ) in the matrix E as the parameters to be transformed, where r∈1~M is the row index, p∈1~L is the bit plane layer index, n∈1~N; S5, layer by layer and row by row, sort the values in the matrix TA whose coordinates are (RO r,n ,n,PO n,p ) to obtain the vector V, layer by layer (bit plane layer), process the corresponding parameters to be transformed based on the vector V on a row-by-row (row of pixels) basis to obtain a scrambled matrix D; S6, XOR the scrambled matrix D to obtain an encrypted image. Among them, the specific steps include:

第一步:假定经过预处理后需要加密的明文图像(即待处理图像)的加密部分(即待处理区域)大小是M×N;Step 1: Assume that the size of the encrypted part (that is, the area to be processed) of the plaintext image (that is, the image to be processed) that needs to be encrypted after preprocessing is M×N;

第二步:将明文图像按比特位面分层,并根据所需加密的比特位面得到一个三维矩阵E,大小为M×N×L,L是加密的比特位面数;(即步骤S1包括第一步到第二步)Step 2: Layer the plaintext image by bit planes, and obtain a three-dimensional matrix E according to the bit planes to be encrypted, with a size of M×N×L, where L is the number of encrypted bit planes; (that is, step S1 Including steps 1 to 2)

第三步:利用混沌系统或伪随机数生成器,生成两个大小分别为M×N,N×L的矩阵,记为RA和PA;Step 3: Use a chaotic system or a pseudo-random number generator to generate two matrices with sizes M×N and N×L, denoted as RA and PA;

第四步:对PA的每一列进行排序,得到一个索引矩阵RO;对PA的每一行进行排序,得到一个索引矩阵PO;(即步骤S2包括第三步~第四步)Step 4: Sort each column of PA to obtain an index matrix RO; sort each row of PA to obtain an index matrix PO; (that is, step S2 includes the third step to the fourth step)

第五步:生成一个大小为M×N×L的矩阵TA,其中TAi,j,k=|RAi,j-PAj,k|;(即步骤S3),i、j、k为对应三维(M、N、L)的具体值。(即步骤S3)Step 5: Generate a matrix TA of size M×N×L, where TA i,j,k =|RA i,j -PA j,k |; (ie step S3), i, j, k are corresponding Specific values for three dimensions (M, N, L). (ie step S3)

第六步:设定行索引为r=1;Step 6: Set the row index to r=1;

第七步:设定比特位面索引为p=1;Step 7: Set the bit plane index to p=1;

第八步:将E中{(ROr,1,1,PO1,p),(ROr,2,2,PO2,p),··,(ROr,N,N,PON,p)}位置的像素挑选出来作为一组;(即步骤S4包括第五步~第八步)Step 8: Put {(RO r,1 ,1,PO 1,p ),(RO r,2 ,2,PO 2,p ),・・,(RO r,N ,N,PO N, p )} position pixels are selected as a group; (that is, step S4 includes the fifth step to the eighth step)

第九步:在TA中对{(ROr,1,1,PO1,p),(ROr,2,2,PO2,p),··,(ROr,N,N,PON,p)}这些位置的值进行排序,得到一个向量v;The ninth step: in TA to {(RO r,1 ,1,PO 1,p ),(RO r,2 ,2,PO 2,p ),・・,(RO r,N ,N,PO N ,p )} sort the values of these positions to get a vector v;

第十步:在E中使用向量v变换这些像素;Step 10: Use the vector v to transform these pixels in E;

第十一步:对每个比特位面进行同样的操作,p=2~L迭代第八步到第十步;The eleventh step: perform the same operation on each bit plane, p=2~L iterates the eighth to tenth steps;

第十二步:对每一行进行同样的操作,r=2~M迭代第七步到第十一步。(即步骤S5包括第九步~十二步)The twelfth step: perform the same operation on each row, r=2~M iterates the seventh to eleventh steps. (That is, step S5 includes the ninth step to the twelfth step)

第十二步:异或所述置乱矩阵D以获取被加密的图像。(即步骤S6)Step 12: XOR the scrambled matrix D to obtain an encrypted image. (ie step S6)

具体的数值例子:假设图像预处理后的大小为2×4,需要加密的比特位面数为3,可以得到一个大小为2×4×3的三维矩阵E,E的每个位置不是0就是1,要对它进行位置置乱。首先利用混沌系统或者伪随机数生成器生成如图2所示的矩阵实例,大小为2×4的RA和大小为4×3的PA;对RA进行列排序,得到索引矩阵RO;对PA进行行排序,得到索引矩阵PO;借助置乱算法找不同行不同列位置,将其扩展到三维,RO的第一行是(2,2,2,1),PO的第一列是(1,2,1,1),将它们与自然顺序一一组合就可以得到不同行、列、比特位面的位置:(2,1,1),(2,2,2),(2,3,1),(1,4,1),在E中以此类推可以得到6组不同行、列和比特位面的位置;Specific numerical example: Assuming that the size of the image after preprocessing is 2×4, and the number of bit planes to be encrypted is 3, a three-dimensional matrix E of size 2×4×3 can be obtained. Each position of E is either 0 or 0. 1, to scramble its position. First, use a chaotic system or a pseudo-random number generator to generate a matrix instance as shown in Figure 2, RA with a size of 2 × 4 and PA with a size of 4 × 3; sort the columns of RA to obtain the index matrix RO; Sort the rows to get the index matrix PO; use the scrambling algorithm to find different rows and different column positions, and expand it to three dimensions, the first row of RO is (2,2,2,1), and the first column of PO is (1, 2,1,1), combine them with the natural order to get the positions of different rows, columns and bit planes: (2,1,1),(2,2,2),(2,3, 1), (1,4,1), by analogy in E, 6 groups of different row, column and bit plane positions can be obtained;

TA则是由RA和PA组合取差的绝对值得到的,例如TA2,1,1=|RA2,1-PA1,1|=|0.3743-0.1579|=0.2146,TA2,2,2=|RA2,2-PA2,2|=|0.2125-0.1525|=0.0600,TA2,3,1=|RA2,3-PA3,1|=|0.4274-0.1612|=0.2662,TA1,4,1=|RA1,4-PA4,1|=|0.4815-0.9408|=0.4593;以此类推,将E中对应TA中的值进行排序,得到向量v,举例其中一个向量为(2,1,3,4),根据向量进行位置置乱:D2,1,1=E2,2,2,D2,2,2=E2,1,1,D2,3,1=E2,3,1,D1,4,1=E1,4,2,其余五组也以此类推,最终得到置乱后的三维矩阵D。 TA is obtained by taking the absolute value of the difference between RA and PA . =|RA 2,2 -PA 2,2 |=|0.2125-0.1525|=0.0600,TA 2,3,1 =|RA 2,3 -PA 3,1 |=|0.4274-0.1612|=0.2662,TA 1 ,4,1 =|RA 1,4 -PA 4,1 |=|0.4815-0.9408|=0.4593; and so on, sort the values in E corresponding to TA to get the vector v, for example, one of the vectors is ( 2,1,3,4), scrambling according to the vector: D 2,1,1 =E 2,2,2 ,D 2,2,2 =E 2,1,1 ,D 2,3,1 =E 2,3,1 , D 1,4,1 =E 1,4,2 , and so on for the remaining five groups, and finally a scrambled three-dimensional matrix D is obtained.

异或的步骤包括:The XOR steps include:

第一步:经过置乱得到的图像矩阵为D,大小为M×N×L;The first step: the image matrix obtained by scrambling is D, and the size is M×N×L;

第二步:对行进行操作,将图像中属于同一行的元素视为整体,应用扩散公式,其中Ci,Ti分别代表第i行所在的平面的异或结果/被异或的值,G=M;The second step: operate on the row, regard the elements belonging to the same row in the image as a whole, and apply the diffusion formula, where C i , T i represent the XOR result/XOR value of the plane where the i-th row is located, respectively, G=M;

第三步:对比特位面进行操作,将图像中属于同一比特位面的元素视为整体,应用扩散公式,其中Ci,Ti代表第i个比特位面的异或结果/被异或的值,G=L;The third step: operate on the bit plane, regard the elements belonging to the same bit plane in the image as a whole, and apply the diffusion formula, where C i , T i represent the XOR result of the i-th bit plane/is XORed The value of , G=L;

第四步:对行进行操作,将图像中属于同一列的元素(像素)视为整体,应用扩散公式,其中Ci,Ti代表第i列所在的平面的异或结果/被异或的值,G=N;Step 4: Operate on the row, regard the elements (pixels) belonging to the same column in the image as a whole, and apply the diffusion formula, where C i , T i represent the XOR result of the plane where the i-th column is located / XORed value, G=N;

扩散公式:

Figure BDA0001882288960000051
Diffusion formula:
Figure BDA0001882288960000051

最后将比特位面与之前未加密的比特位面整合,压缩成图像的像素值,并与未预处理部分组合,从而得到密文图像。Finally, the bit plane is integrated with the previously unencrypted bit plane, compressed into the pixel value of the image, and combined with the unpreprocessed part to obtain the ciphertext image.

具体的预处理步骤包括:The specific preprocessing steps include:

(1)用Sobel算子对图像(初始图像)进行边缘检测得到二进制边缘图像BW(边缘图像);(2)利用连通区域函数过滤出连通域面积在

Figure BDA0001882288960000052
之间的部分AO(第一区域),S为图像的面积;(3)对AO进行形态学处理,先腐蚀,再移除孤立像素,最后加厚补偿得到MO(第二区域);(4)AO按像素与MO,再求凸包得到CH(第三区域);(5)最后度量CH的属性,得到目标区域(待处理图像)。(1) Use the Sobel operator to detect the edge of the image (initial image) to obtain the binary edge image BW (edge image); (2) Use the connected area function to filter out the connected area area in
Figure BDA0001882288960000052
The part between AO (first area), S is the area of the image; (3) Morphological processing is performed on AO, first etching, then removing isolated pixels, and finally thickening compensation to obtain MO (second area); (4) ) AO is based on pixels and MO, and then the convex hull is calculated to obtain CH (third region); (5) Finally, the attribute of CH is measured to obtain the target region (image to be processed).

实施例2Example 2

本实施例提供一种图像加密系统,包括:标记模块1,用于根据比特位面分层待处理图像,标记待处理图像的待处理区域的尺寸为M×N,输出对应的三维矩阵E,E的尺寸为M×N×L,其中,L为位面层数;索引模块2,用于随机生成M×N的矩阵RA,获取对应的索引矩阵RO,随机生成N×L的矩阵PA,获取对应的索引矩阵PO;重组模块3,用于生成与三维矩阵E尺寸一致的矩阵TA,TAi,j,k=|RAi,j-PAj,k|,其中,i,j,k为三维坐标;置乱模块4,用于逐层、逐行地选择矩阵E中坐标为(ROr,n,n,POn,p)的像素以作为待变换参数,其中,r∈1~M为行索引,p∈1~L为位面层索引,n∈1~N;置乱模块,还用于逐层、逐行地将矩阵TA中坐标为(ROr,n,n,POn,p)的值进行排序以获取向量V,基于所述向量V处理对应的待变换参数以获取置乱矩阵D;异或模块5,用于异或所述置乱矩阵D以获取被加密的图像。This embodiment provides an image encryption system, including: a marking module 1, configured to layer images to be processed according to bit planes, mark the size of the to-be-processed area of the to-be-processed image as M×N, and output a corresponding three-dimensional matrix E, The size of E is M×N×L, where L is the number of bit plane layers; the index module 2 is used to randomly generate an M×N matrix RA, obtain the corresponding index matrix RO, and randomly generate an N×L matrix PA, Obtain the corresponding index matrix PO; the reorganization module 3 is used to generate a matrix TA with the same size as the three-dimensional matrix E, TA i,j,k =|RA i,j -PA j,k |, where i,j,k is the three-dimensional coordinate; scrambling module 4 is used to select the pixels whose coordinates are (RO r,n ,n,PO n,p ) in the matrix E layer by layer and row by row as the parameters to be transformed, where r∈1~ M is the row index, p∈1~L is the bit plane layer index, n∈1~N; the scrambling module is also used for layer-by-layer and row-by-row coordinates in the matrix TA as (RO r,n ,n,PO n, p ) values are sorted to obtain a vector V, and the corresponding parameters to be transformed are processed based on the vector V to obtain a scrambled matrix D; XOR module 5 is used to XOR the scrambled matrix D to obtain encrypted Image.

以上是对本发明的较佳实施进行了具体说明,但本发明创造并不限于所述实施例,熟悉本领域的技术人员在不违背本发明精神的前提下还可做出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments, and those skilled in the art can also make various equivalent deformations or substitutions on the premise of not violating the spirit of the present invention , these equivalent modifications or substitutions are all included within the scope defined by the claims of the present application.

Claims (10)

1.一种图像加密方法,其特征在于,包括步骤:1. an image encryption method, is characterized in that, comprises the steps: S1、根据比特位面分层待处理图像,标记待处理图像的待处理区域的尺寸为M×N,输出对应的三维矩阵E,E的尺寸为M×N×L,其中,L为位面层数;S1. Layer the to-be-processed images according to the bit plane, mark the size of the to-be-processed area of the to-be-processed image as M×N, and output the corresponding three-dimensional matrix E, where the size of E is M×N×L, where L is the bit plane layers; S2、随机生成M×N的矩阵RA,获取对应的索引矩阵RO,随机生成N×L的矩阵PA,获取对应的索引矩阵PO;S2. Randomly generate an M×N matrix RA, obtain a corresponding index matrix RO, randomly generate an N×L matrix PA, and obtain a corresponding index matrix PO; S3、生成与三维矩阵E尺寸一致的矩阵TA,TAi,j,k=|RAi,j-PAj,k|,其中,i,j,k为三维坐标;S3, generate a matrix TA with the same size as the three-dimensional matrix E, TA i,j,k =|RA i,j -PA j,k |, wherein, i,j,k are three-dimensional coordinates; S4、逐层、逐行地选择矩阵E中坐标为(ROr,n,n,POn,p)的像素以作为待变换参数,其中,r∈1~M为行索引,p∈1~L为位面层索引,n∈1~N;S4. Select the pixel whose coordinates are (RO r,n ,n,PO n,p ) in the matrix E layer by layer and row by row as the parameter to be transformed, where r∈1~M is the row index, p∈1~ L is the index of the plane layer, n∈1~N; S5、逐层、逐行地将矩阵TA中坐标为(ROr,n,n,POn,p)的值进行排序以获取向量V,基于所述向量V处理对应的待变换参数以获取置乱矩阵D;S5. Sort the values with coordinates (RO r,n ,n,PO n,p ) in the matrix TA layer by layer and row by row to obtain a vector V, and process the corresponding parameters to be transformed based on the vector V to obtain the set chaotic matrix D; S6、异或所述置乱矩阵D以获取被加密的图像。S6, XOR the scrambled matrix D to obtain an encrypted image. 2.根据权利要求1所述的一种图像加密方法,还包括步骤S0、对初始图像进行预处理,其特征在于,步骤S0包括:2. An image encryption method according to claim 1, further comprising step S0, preprocessing the initial image, wherein step S0 comprises: 对初始图像进行二进制处理以得到边缘图像,利用连通区域函数过滤出符合阈值的第一区域,对第一区域进行形态处理以获得待处理图像。Binary processing is performed on the initial image to obtain an edge image, a connected area function is used to filter out a first area that meets the threshold, and morphological processing is performed on the first area to obtain an image to be processed. 3.根据权利要求1所述的一种图像加密方法,其特征在于,步骤S6具体包括:3. a kind of image encryption method according to claim 1, is characterized in that, step S6 specifically comprises: 按照行、列和层的顺序异或所述置乱矩阵D以获取被加密的图像。XOR the scrambled matrix D in row, column and layer order to obtain an encrypted image. 4.根据权利要求1所述的一种图像加密方法,其特征在于,步骤S2具体包括:4. a kind of image encryption method according to claim 1, is characterized in that, step S2 specifically comprises: 基于混沌系统或伪随机数生成器生成M×N的矩阵RA和N×L的矩阵PA,然后对PA的每一列进行排序,得到索引矩阵RO,对PA的每一行进行排序,得到索引矩阵PO。Generate an M×N matrix RA and an N×L matrix PA based on a chaotic system or a pseudo-random number generator, then sort each column of PA to get the index matrix RO, and sort each row of PA to get the index matrix PO . 5.根据权利要求2所述的一种图像加密方法,其特征在于,对符合阈值的部分进行形态处理具体包括:5. A kind of image encryption method according to claim 2, is characterized in that, performing morphological processing to the part that meets the threshold value specifically comprises: 对第一区域进行腐蚀处理,移除孤立像素,加厚补偿以获得第二区域,第一区域按像素与第二区域,通过求凸包获得第三区域,度量第三区域的属性以获得待处理图像。The first area is eroded, the isolated pixels are removed, the thickness compensation is increased to obtain the second area, the first area is divided into pixels and the second area, the third area is obtained by calculating the convex hull, and the properties of the third area are measured to obtain the desired area. Process images. 6.一种图像加密系统,其特征在于,包括:6. an image encryption system, is characterized in that, comprises: 标记模块,用于根据比特位面分层待处理图像,标记待处理图像的待处理区域的尺寸为M×N,输出对应的三维矩阵E,E的尺寸为M×N×L,其中,L为位面层数;The marking module is used for layering the to-be-processed images according to the bit plane, marking the size of the to-be-processed area of the to-be-processed image as M×N, and outputs the corresponding three-dimensional matrix E, where the size of E is M×N×L, where L is the number of plane layers; 索引模块,用于随机生成M×N的矩阵RA,获取对应的索引矩阵RO,随机生成N×L的矩阵PA,获取对应的索引矩阵PO;The index module is used to randomly generate an M×N matrix RA, obtain the corresponding index matrix RO, randomly generate an N×L matrix PA, and obtain the corresponding index matrix PO; 重组模块,用于生成与三维矩阵E尺寸一致的矩阵TA,TAi,j,k=|RAi,j-PAj,k|,其中,i,j,k为三维坐标;The reorganization module is used to generate a matrix TA with the same size as the three-dimensional matrix E, TA i,j,k =|RA i,j -PA j,k |, where i, j, k are three-dimensional coordinates; 置乱模块,用于逐层、逐行地选择矩阵E中坐标为(ROr,n,n,POn,p)的像素以作为待变换参数,其中,r∈1~M为行索引,p∈1~L为位面层索引,n∈1~N;The scrambling module is used to select the pixels whose coordinates are (RO r,n ,n,PO n,p ) in the matrix E layer by layer and row by row as the parameters to be transformed, where r∈1~M is the row index, p∈1~L is the bit plane layer index, n∈1~N; 置乱模块,还用于逐层、逐行地将矩阵TA中坐标为(ROr,n,n,POn,p)的值进行排序以获取向量V,基于所述向量V处理对应的待变换参数以获取置乱矩阵D;The scrambling module is also used to sort the values whose coordinates are (RO r,n ,n,PO n,p ) in the matrix TA layer by layer and row by row to obtain a vector V, and process the corresponding pending Transform parameters to obtain scrambling matrix D; 异或模块,用于异或所述置乱矩阵D以获取被加密的图像。The XOR module is used to XOR the scrambled matrix D to obtain the encrypted image. 7.根据权利要求6所述的一种图像加密系统,其特征在于,还包括:7. A kind of image encryption system according to claim 6, is characterized in that, also comprises: 预处理模块,用于对初始图像进行二进制处理以得到边缘图像,利用连通区域函数过滤出符合阈值的第一区域,对第一区域进行形态处理以获得待处理图像。The preprocessing module is used to perform binary processing on the initial image to obtain an edge image, filter out the first region that meets the threshold by using the connected region function, and perform morphological processing on the first region to obtain the image to be processed. 8.根据权利要求6所述的一种图像加密系统,其特征在于,所述异或模块,具体用于按照行、列和层的顺序异或所述置乱矩阵D以获取被加密的图像。8 . The image encryption system according to claim 6 , wherein the XOR module is specifically configured to XOR the scrambled matrix D according to the order of rows, columns and layers to obtain the encrypted image. 9 . . 9.根据权利要求6所述的一种图像加密系统,其特征在于,所述索引模块,用于基于混沌系统或伪随机数生成器生成M×N的矩阵RA和N×L的矩阵PA,然后对PA的每一列进行排序,得到索引矩阵RO,对PA的每一行进行排序,得到索引矩阵PO。9. A kind of image encryption system according to claim 6, is characterized in that, described index module is used for generating the matrix RA of M×N and the matrix PA of N×L based on chaotic system or pseudo-random number generator, Then sort each column of PA to get the index matrix RO, and sort each row of PA to get the index matrix PO. 10.根据权利要求7所述的一种图像加密系统,其特征在于,所述预处理模块对符合阈值的部分进行形态处理具体包括:10. An image encryption system according to claim 7, characterized in that, the morphological processing performed by the preprocessing module on the part that meets the threshold specifically comprises: 对第一区域进行腐蚀处理,移除孤立像素,加厚补偿以获得第二区域,第一区域按像素与第二区域,通过求凸包获得第三区域,度量第三区域的属性以获得待处理图像。The first area is eroded, the isolated pixels are removed, the thickness compensation is increased to obtain the second area, the first area is divided into pixels and the second area, the third area is obtained by calculating the convex hull, and the properties of the third area are measured to obtain the desired area. Process images.
CN201811429064.8A 2018-11-27 2018-11-27 Image encryption method and system Active CN109657483B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811429064.8A CN109657483B (en) 2018-11-27 2018-11-27 Image encryption method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811429064.8A CN109657483B (en) 2018-11-27 2018-11-27 Image encryption method and system

Publications (2)

Publication Number Publication Date
CN109657483A CN109657483A (en) 2019-04-19
CN109657483B true CN109657483B (en) 2022-04-22

Family

ID=66111650

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811429064.8A Active CN109657483B (en) 2018-11-27 2018-11-27 Image encryption method and system

Country Status (1)

Country Link
CN (1) CN109657483B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110430036B (en) * 2019-07-05 2021-09-07 云南大学 RGB (Red, Green and blue) color image encryption method based on inverse difference chaotic mapping
CN110879894B (en) * 2019-11-11 2023-04-07 陕西师范大学 Image encryption and decryption method based on lazy scale transformation and random layered fusion
CN110969564B (en) * 2019-11-29 2020-11-24 珠海大横琴科技发展有限公司 Image encryption method and device, electronic equipment and readable storage medium
CN112205996B (en) * 2020-11-01 2023-05-26 南昌华亮光电有限责任公司 Image encryption system and method based on photon random offset
CN114244559B (en) * 2021-11-09 2023-01-17 泰瑞数创科技(北京)股份有限公司 Dynamic encryption method, system and storage medium for map data in database
CN114821080B (en) * 2022-06-30 2022-09-02 青岛农村商业银行股份有限公司 Agricultural product purchase management platform and efficient communication method of business data thereof
CN117015953B (en) * 2022-07-04 2024-07-09 徐连英 Security encryption method and system for face data of access control system
CN115203723B (en) * 2022-07-20 2023-06-09 浙江东昊信息工程有限公司 Information encryption processing system for temple
CN116033088B (en) * 2023-03-27 2023-06-16 山东爱特云翔计算机有限公司 Safe transmission method and system for video big data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440617A (en) * 2013-09-18 2013-12-11 黄良永 Image processing method for improving safety of medical image
CN106530207A (en) * 2016-12-06 2017-03-22 南京理工大学 Logistic chaotic mapping-based digital image encryption method
CN107392970A (en) * 2017-07-12 2017-11-24 湖北民族学院 A kind of digital image encryption algorithm based on bit plane and high-dimension chaotic system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440617A (en) * 2013-09-18 2013-12-11 黄良永 Image processing method for improving safety of medical image
CN106530207A (en) * 2016-12-06 2017-03-22 南京理工大学 Logistic chaotic mapping-based digital image encryption method
CN107392970A (en) * 2017-07-12 2017-11-24 湖北民族学院 A kind of digital image encryption algorithm based on bit plane and high-dimension chaotic system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
2D Logistic-Sine-coupling map for image encryption;Zhongyun Hua 等;《Signal Processing》;20180316;第148-161页 *
A novel bit-level image encryption algorithm based on 2D-LICM hyperchaotic map;Chun Cao 等;《Signal Processing》;20170830;第122-133页 *
Image encryptionusingbinarybitplane;Yicong Zhou;《Signal Processing》;20140130;第197-207页 *
基于混沌理论的位变换图像加密算法;潘天工等;《电机与控制学报》;20131015(第10期);第97-100,108页 *

Also Published As

Publication number Publication date
CN109657483A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
CN109657483B (en) Image encryption method and system
Qin et al. An efficient coding scheme for reversible data hiding in encrypted image with redundancy transfer
CN111031193B (en) Image Encryption Method Based on Stereo Composite Scrambling Model and Chaos
CN105404817B (en) It is based on(k, n)The user-friendly visual secret sharing scheme method of thresholding
CN114362915B (en) An image encryption method based on DNA coding technology and hyperchaotic system
CN109684857B (en) Information hiding method, terminal device and storage medium
Chang et al. A sudoku-based secret image sharing scheme with reversibility
CN112906043A (en) Image encryption method based on chaotic mapping and chaotic S-box substitution
CN109635576A (en) A kind of hiding data method and system in the picture
Kandar et al. Visual cryptography scheme for color image using random number with enveloping by digital watermarking
Chen et al. A Geometry-Based Secret Image Sharing Approach.
CN113132079B (en) Multi-image encryption method and decryption method
Kuo et al. A Formula Diamond Encoding Data Hiding Scheme.
CN106127669A (en) Based on protecting the New chaotic image encryption method that area B aker maps
Gupta et al. An effective approach of secured medical image transmission using encryption method
Ali et al. Multi-level encryption for 3D mesh model based on 3D Lorenz chaotic map and random number generator.
Zhang et al. A visual secret sharing scheme based on improved local binary pattern
CN110838908A (en) An Image Encryption and Decryption Method Based on GF Matrix Transformation and Random Hierarchical Fusion
Chiu et al. An XOR-based progressive visual cryptography with meaningful shares
Wang et al. A novel (n, n) secret image sharing scheme based on Sudoku
Sun et al. An image encryption algorithm utilizing Mandelbrot set
Siahaan Vernam Conjugated Manipulation of Bit-Plane Complexity Segmentation
CN112330521B (en) Image encryption method
Lee et al. Data Hiding Scheme Based on A Flower-Shaped Reference Matrix.
CN112184841A (en) Block replacement generating type information hiding and recovering method, device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information

Inventor after: Hua Zhongyun

Inventor after: Jin Fan

Inventor after: Huang Hejiao

Inventor after: Xu Guoai

Inventor before: Hua Zhongyun

Inventor before: Jin Fan

Inventor before: Huang Hejiao

CB03 Change of inventor or designer information