Image encryption method and device based on LBP coding adaptive division

By using the LBP encoding adaptive partitioning method, important regions of an image are identified and encrypted. Combined with diffusion and scrambling techniques, this method solves the problems of insufficient accuracy and security in existing image encryption methods, achieving a highly efficient image encryption effect.

CN116488786BActive Publication Date: 2026-03-20HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing image encryption methods lack accuracy and rationality in identifying important information areas of images, resulting in low security and efficiency of selective encryption, especially in real-time image transmission environments where effective protection is difficult to achieve.

Method used

An adaptive partitioning method based on LBP coding is adopted. By performing local binary mode coding on the image, important image blocks are extracted and diffused. Combined with Josephus scrambling and block-level closed-loop diffusion, the image information can be accurately partitioned and encrypted.

Benefits of technology

It improves the security and efficiency of image encryption, is applicable to various image types, and significantly enhances encryption performance, especially in scenarios involving the encryption of massive image data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116488786B_ABST
    Figure CN116488786B_ABST
Patent Text Reader

Abstract

The application discloses an image encryption method and device based on LBP coding adaptive division, which comprises the following steps: LBP coding is performed on an original image to obtain an LBP texture spectrum graph; the texture spectrum graph is divided into blocks; the LBP measure U of the pixel points in the whole image and each sub-block is calculated; the proportion of the pixel points with U=2 in the total pixel points of the whole image and each sub-block is calculated; the calculated proportions are compared; important blocks are divided and pixel-level diffusion is performed on the important blocks; the diffusion results of the important blocks and the remaining blocks are combined into the size of the original image; the whole row and column synchronous adaptive Joseph permutation is performed; the block-level diffusion is performed on the permutation results; the diffusion results of the last block are used to update the diffusion results of the first block to realize a closed loop; and finally, a ciphertext image is obtained. The method has higher security and is a safe and efficient encryption scheme.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of image encryption, and particularly relates to an image encryption method and device based on LBP coding adaptive division. BACKGROUND

[0002] With the development of Internet technology, more and more information, especially image data, is widely spread in the network, and it is also more vulnerable to illegal attacks by humans, leading to the leakage of private information. An efficient image encryption algorithm is one of the effective means to actively protect image information.

[0003] At present, according to the different image security scenarios, image encryption algorithms are divided into two kinds of encryption of complete images and encryption of partial images. Complete image encryption is to encrypt all the data of the image to obtain high security, while partial image encryption, also called selective image encryption, is to protect part of the image data. The core idea behind the selective encryption technology is to identify important and unimportant regions or pixels from the image, and then encrypt the important data. For example, Khan et al. divide the original image into blocks, select the image blocks for encryption through the autocorrelation coefficients of the sub-blocks and set a threshold. However, the selection of the threshold is not derived or proved, that is, there is a lack of a credible and effective image important information division method. In the existing selective encryption methods, the accuracy and rationality of the identification of important information, i.e. the region of interest, of the image are insufficient. Therefore, in the environment of real-time image transmission application, accurate and effective image region of interest division and secure and efficient encryption method have become one of the current problems. SUMMARY

[0004] The purpose of the application is to provide an image encryption method and device based on LBP coding adaptive division, which improves the encryption performance by performing local binary pattern (LBP) coding on the image, extracting important image blocks according to the LBP texture features, and performing diffusion operation on the important image blocks and then merging the image blocks as a whole to disperse and diffuse.

[0005] To achieve the above purpose, the technical scheme adopted by the application is as follows:

[0006] The application provides an image encryption method based on LBP coding adaptive division, which comprises the following steps:

[0007] LBP coding is performed on the original image P to obtain an LBP texture spectrum image Plbp;

[0008] The number of pixels with a transition number of 2 in the LBP texture spectrum Plbp is calculated as a proportion U_LBP of the total number of pixels in the LBP texture spectrum Plbp, and the LBP texture spectrum Plbp is divided into sub-blocks of the same size, and the proportion u_block of the number of pixels with a transition number of 2 in each sub-block to the total number of pixels in the sub-block is calculated; the transition number refers to the number of times that the corresponding cyclic binary number in the LBP texture spectrum Plbp changes from 0 to 1 or from 1 to 0;

[0009] The proportion u_block calculated based on the sub-blocks is compared with the proportion U_LBP calculated based on the entire LBP texture spectrum Plbp, important sub-blocks are identified, and the important sub-blocks are added to the matrix PA, and the sub-blocks that are not identified as important sub-blocks are added to the matrix PB;

[0010] The matrix PA is diffused to obtain a matrix TC;

[0011] The matrix TC and the matrix PB are merged, and an image Q of the original image size is obtained;

[0012] A Josephus permutation operation with adaptive variable length is performed on the image Q to obtain a permutation image D;

[0013] A block-level closed-loop diffusion is performed on the permutation image D to obtain a final ciphertext image C.

[0014] Further, the LBP texture spectrum Plbp is divided into sub-blocks of the same size, including:

[0015] The LBP texture spectrum Plbp is divided into sub-blocks of 16x16, and the total number of sub-blocks c is:

[0016] Where MxN is the size of the original image P.

[0017] Further, the proportion u_block calculated based on the sub-blocks is compared with the proportion U_LBP calculated based on the entire image to identify important sub-blocks, including:

[0018] The proportion u_block calculated for each sub-block is compared with U_LBP, if u_block≥U_LBP, the sub-block is an important sub-block, otherwise, it is not an important sub-block.

[0019] Further, the matrix PA is diffused to obtain a matrix TC, including:

[0020] An initial value is selected, and a chaotic sequence S with a length of 256xcount is generated by iterating a 2D-LSCM chaotic system, where count is the number of important sub-blocks;

[0021] The sort function is used on the chaotic sequence S to perform ascending order sorting, and an index sequence O is obtained;

[0022] The reshape function is used on the matrix PA to convert it into a one-dimensional sequence T, and combined with the index sequence O, diffusion is performed to obtain a one-dimensional sequence TC:

[0023]

[0024] Wherein, TC i represents the i-th element in the one-dimensional sequence TC, T i represents the i-th element in the one-dimensional sequence T, represents the exclusive or operation, T o(i) represents the o(i)-th element in the one-dimensional sequence T, o(i) represents the i-th element in the index sequence O, S i represents the i-th element in the chaotic sequence S, F is the number of pixel values allowed in the plaintext image, and the operator is the maximum integer less than or equal to X;

[0025] The reshape function is used on the one-dimensional sequence TC to convert it into a 16x16count matrix TC.

[0026] Further, an adaptive variable-length Josephus permutation operation is performed on the image Q to obtain a permuted image D, including:

[0027] Step S21, generating initial positions and step length parameters in the length and width directions;

[0028] Step S22, generating a Josephus sequence Row with a length of M based on the initial position and step length parameter in the length direction;

[0029] Step S23, generating a Josephus matrix Col with a size of MxN based on the initial position and step length parameter in the width direction;

[0030] Step S24, rearranging the i-th row of pixels of the image Q in the following manner:

[0031] Index(i,:)={(Row(Col(i,1))+i,Col(i,1)),…,(Row(Col(i,k))+i,Col(i,k)),

[0032] (Row(Col(i,k+1))+i,Col(i,k+1)),…,(Row(Col(i,N))+i,Col(i,N))}

[0033] If Row(Col(i,k))+i>M, then,

[0034] Row(Col(i,k))+i=mod(Row(Col(i,k))+i,M);

[0035] Step S25, repeat steps S23 to S24 until all pixels complete row and column synchronization scrambling operation, get scrambled image D.

[0036] Further, the initial position and step length parameter in length and width direction are generated, including:

[0037] MP=mod(Sum,M), MStep=mod(SumLbp,M);

[0038] NP=mod(SumLbp,N), NStep=mod(Sum,N);

[0039] Wherein, MP and NP are the initial position in length and width direction respectively, MStep is the step length in length direction, NStep is the step length in width direction, Sum is the sum of all pixels of the original image P, SumLbp is the sum of all pixels of the LBP texture spectrum image Plbp.

[0040] Further, the Joseph sequence Row with length M is generated based on the initial position and step length parameter in length direction, including:

[0041] Step 221: initialize vector A=[1,2,…,M];

[0042] Step 222: set Row(1)=MP and delete Row(1) from A, wherein Row(1) refers to the first element in Row;

[0043] Step 223: from the deleted position, cyclic shift MStep steps and assign the current value to Row(2);

[0044] Step 224: update the step length as: MStep=MStep+1;

[0045] Step 225: repeat steps 223 and 224 until all values in A are assigned to Row.

[0046] Further, the Joseph matrix Col with size M×N is generated based on the initial position and step length parameter in width direction, including:

[0047] Step 231: for the ith row, initialize vector B=[1,2,…,N];

[0048] Step 232: set Col(i,1)=NP and delete Col(i,1) from B; Col(i,1) represents the element in the first column of the ith row of the matrix Col;

[0049] Step 233: Circularly shift NStep and assign the current value B(j) to Col(i,2) from the deleted position;

[0050] Step 234: Update the step length as:

[0051] Step 235: Repeat steps 233 and 234 until all values in B are assigned to Col(i,:);

[0052] Step 236: Update NP as: NP = Col(i,N).

[0053] Further, the scrambled image D is subjected to block-level closed-loop diffusion to obtain a final ciphertext image C, comprising:

[0054] An initial value is selected, and two chaotic matrices Z and W with a size of 16x16 are generated using a 2D-LSCM chaotic system, and chaotic blocks G, u, and v are generated based on Z and W, as follows:

[0055]

[0056]

[0057]

[0058] wherein, 1≤k≤16, 1≤l≤16, {e,f} represents the index of the chaotic block pair in G, k and l represent the row index and column index in each chaotic block respectively, and the index in G corresponds to the index in the current plaintext block D that needs to be diffused; 1≤k≤16, 1≤l≤16, {e,f} represents the index of the chaotic block pair in G, k and l represent the row index and column index in each chaotic block respectively, and the index in G corresponds to the index in the current plaintext block D that needs to be diffused;

[0059] The scrambled image D is divided into 16x16 small blocks, denoted as:

[0060]

[0061] Block-level diffusion is performed according to the following formula:

[0062]

[0063] The first ciphertext block is updated using the chaotic block v, the first and last ciphertext blocks subjected to block-level diffusion, and subjected to closed-loop diffusion to obtain a final ciphertext image C, and the first ciphertext block C{1,1} is updated as follows:

[0064]

[0065] ​The application further provides an image encryption device based on LBP coding adaptive division, which is used for realizing the image encryption method based on LBP coding adaptive division.

[0066] The coding module is configured to perform LBP coding on the original image P to obtain an LBP texture spectrum image Plbp.

[0067] The computing module is configured to calculate a proportion U_LBP of the number of pixel points with a transition number of 2 in the LBP texture spectrum image Plbp to the total number of pixel points in the LBP texture spectrum image Plbp, and divide the LBP texture spectrum image Plbp into subblocks of the same size, calculate a proportion u_block of the number of pixel points with a transition number of 2 in each subblock to the total number of pixel points in the subblock, wherein the transition number refers to the number of times that the corresponding cyclic binary number in the LBP texture spectrum image Plbp changes from 0 to 1 or from 1 to 0.

[0068] The identifying module is configured to compare the proportion u_block calculated based on the subblock with the proportion U_LBP calculated based on the LBP texture spectrum image Plbp, identify important subblocks, add the important subblocks to the matrix PA, and add the subblocks that are not identified as important subblocks to the matrix PB.

[0069] The diffusion module is configured to diffuse the matrix PA to obtain a matrix TC.

[0070] The merging module is configured to merge the matrix TC and the matrix PB, and convert the merged matrix into an image Q of the size of the original image.

[0071] The scrambling module is configured to perform adaptive variable-length Josephus scrambling on the image Q to obtain a scrambled image D.

[0072] The encryption module is configured to perform block-level closed-loop diffusion on the scrambled image D to obtain a final ciphertext image C.

[0073] Compared with the prior art, the application has the following beneficial effects:

[0074] 1. The application provides an image encryption method based on LBP coding adaptive division, which measures the amount of image information according to the texture features of the image at the pixel level, extracts important blocks according to the size of the amount of information and diffuses the important blocks, and then merges the image blocks to perform overall Josephus scrambling and block-level closed-loop diffusion, so that the security is higher than that of the method of selecting partial image encryption, and the encryption scheme is safe and efficient.

[0075] 2. The LBP coding adaptive division method is suitable for various image types, and the image blocks are divided by using the LBP texture features, so that the method is more accurate than the method of randomly selecting blocks.

[0076] 3、The image encryption method of the present application has different division methods for each image, and in the encryption scene of massive image data, the overall encryption performance is improved compared with the encryption algorithm of randomly selecting blocks. BRIEF DESCRIPTION OF DRAWINGS

[0077] Figure 1 A flowchart of an image encryption method based on LBP coding adaptive division is provided in the present application;

[0078] Figure 2 An example of inserting 0 values into the original image in the embodiment of the present application;

[0079] Figure 3 An example of LBP coding calculation in the embodiment of the present application;

[0080] Figure 4 The original image and the texture image generated by LBP coding in the embodiment of the present application;

[0081] Figure 5 An example of the existing Joseph sequence generation process;

[0082] Figure 6 An example of the adaptive variable-length Joseph permutation process provided in the embodiment of the present application. DETAILED DESCRIPTION

[0083] The present application will be further described below. The following embodiments are only used to more clearly illustrate the technical solutions of the present application, and cannot be used to limit the protection scope of the present application.

[0084] The present application provides an image encryption method based on LBP coding adaptive division, as shown in Figure 1 , which comprises:

[0085] LBP coding is performed on the original image P to obtain an LBP texture spectrum image Plbp;

[0086] The proportion U_LBP of the number of pixel points with a transition number of 2 in the LBP texture spectrum image Plbp to the total number of pixel points in the entire LBP texture spectrum image Plbp is calculated, and the LBP texture spectrum image Plbp is divided into sub-blocks of the same size, and the proportion u_block of the number of pixel points with a transition number of 2 in each sub-block to the total number of pixel points in the sub-block is calculated;

[0087] The proportion u_block calculated for each sub-block is compared with the proportion U_LBP calculated for the entire image, important sub-blocks are identified, and the important sub-blocks are added to the matrix PA, and the sub-blocks not identified as important sub-blocks are added to the matrix PB;

[0088] The matrix PA is diffused to obtain the matrix TC;

[0089] Merging the matrix TC with the matrix PB to obtain an image Q;

[0090] Performing a Joseph permutation operation with adaptive length on the image Q to obtain a permuted image D;

[0091] Performing a block-level closed-loop diffusion on the permuted image D to obtain a final ciphertext image C.

[0092] In an embodiment of the present application, before LBP encoding of the original image, the following is further included:

[0093] LBP encoding requires a 3x3 window, in order to calculate the LBP values of the first row, the first column, the last row and the last column of the original image, 0 values are inserted around the original image P to obtain an image P', the number of which is 2M+2N+4, as shown in the following formula: Figure 2 wherein the size of the original image P is MxN.

[0094] In an embodiment of the present application, LBP encoding is performed on the original image P to obtain an LBP texture spectrum image Plbp, and the specific implementation process is as follows:

[0095] An LBP operator is defined in a 3x3 window, and the center pixel is taken as a threshold value, and the gray scale values of the adjacent 8 pixels are compared, if the pixel values around the center pixel are greater than the center pixel value, then the position is marked as 1, otherwise marked as 0. In this way, an 8-bit binary number can be obtained, which is converted to decimal to obtain the final LBP code, and this value is taken as the LBP value of the center pixel of the window, so as to represent the texture information of the region. The value range of the LBP value is [0, 255], and the calculation formula is as follows:

[0096]

[0097]

[0098] wherein i c represents the gray scale value of the center pixel (x c ,y c ), i n is the gray scale value of the 8 adjacent points, and S(x) is the LBP encoding value of the pixel point x. The calculation example is shown in the following formula: Figure 3 Figure 4 shows an original image and a texture spectrum image after LBP encoding.

[0099] The LBP code is invariant to any monotonic gray scale transformation, that is, the binary code of the local neighborhood remains unchanged before and after the transformation.

[0100] In an embodiment of the present application, the number of jumps is calculated as follows: ​

[0101] The LBP measure is a 0-1 transformation frequency measure, i.e. the number of times the cyclic binary number corresponding to the LBP code jumps from 0 to 1 or from 1 to 0, which can be defined as:

[0102]

[0103] Where, i c represents the gray value of the center pixel (x c ,y c ), i n is the gray value of the neighboring point n, and S(i n -i c ) is the label value of the position point n.

[0104] In an embodiment of the present application, the LBP texture spectrum Plbp is divided into sub-blocks with a size of 16x16, and the total number is

[0105] In an embodiment of the present application, the ratio u_block calculated based on each sub-block is compared with the ratio U_LBP calculated based on the whole image to identify important sub-blocks, and the specific implementation process is as follows:

[0106] The ratio u_block calculated based on each sub-block is compared with the ratio U_LBP, if u_block≥U_LBP, then the sub-block is an important sub-block, otherwise, it is not an important sub-block.

[0107] In an embodiment of the present application, the important sub-blocks are added to the matrix PA, and the sub-blocks not identified as important sub-blocks are added to the matrix PB, and the specific implementation process is as follows:

[0108] The important sub-blocks are added to the matrix PA through PA=[PA X], X represents the important sub-blocks, with a size of 16x16 and a number of count, and then the size of PA is 16x16count;

[0109] Similarly, the sub-blocks not identified as important sub-blocks are added to the matrix PB, with a size of 16x16(c-count).

[0110] In an embodiment of the present application, the matrix PA is diffused to obtain the matrix TC, and the specific implementation process is as follows:

[0111] In step S11, a chaotic sequence with a length of 256xcount, i.e. S, is generated by using a 2D-Logistic-Sine-coupling-map (2D-LSCM) chaotic system with x0, y0, r0 as initial values.

[0112] The definition of 2D-LSCM is as follows:

[0113]

[0114] where r is a control parameter and r ∈ (0, 1).

[0115] Step S12, the generated chaotic sequence S is sorted in ascending order by using the sort function, and an index sequence O is obtained.

[0116] Step S13, the matrix PA is converted into a one-dimensional sequence T by using the reshape function, and the length is 256 × count. The one-dimensional sequence TC is obtained by diffusion according to the following formula:

[0117]

[0118] where TC i represents the ith element in the one-dimensional sequence TC, count is the number of important sub-blocks, represents the exclusive or operation, T o(i) represents the o(i)th element in the one-dimensional sequence T, o(i) represents the ith element in the index sequence O, S i represents the ith element in the chaotic sequence S, F is the number of pixel values allowed in the plaintext image, for example, when P is an 8-bit gray level image, F = 256, and the operator is the maximum integer less than or equal to X.

[0119] Step S14, the one-dimensional sequence TC is converted into a 16 × 16 count matrix TC by using the reshape function.

[0120] In an embodiment of the present application, the matrix TC and the matrix PB are combined into a matrix Q, specifically,

[0121] The matrix TC and the matrix PB are combined into a matrix Q by Q = [TC PB], and the size is 16 × 16c.

[0122] The size of the image Q is converted to M × N by using the reshape function.

[0123] In an embodiment of the present application, an adaptive length Joseph permutation operation is performed on the image Q to obtain a permutation image D, and the specific implementation process is as follows:

[0124] The Joseph problem is that a certain number of elements are placed in a circle, and the elements can be removed from the circle starting from a specified element, and then a fixed number of elements are moved in a cycle to find the current element. The next iteration starts from the current iteration. Repeat this operation until the last element is used. Finally, according to the order of the elements to be removed from the circle, a sequence, i.e., a Joseph sequence, can be obtained. The Joseph sequence can be described as:

[0125] q = JS(n, s, k);

[0126] wherein n is the total number of elements, s represents the starting position, k is the number of shifts, and q is the generated Joseph sequence.

[0127] In order to better explain the Joseph sequence, an example of using n=8, s=2, k=3 in the equation is given, Figure 5 The generation process of the Joseph sequence is shown.

[0128] The Joseph sequence can randomly change the positions of a one-dimensional array. However, a digital image is a two-dimensional matrix. Considering the properties of the two-dimensional matrix, the adaptive variable-length Joseph permutation algorithm that can simultaneously shuffle the row and column positions is designed in this embodiment, and the specific operation is as follows:

[0129] Step S21, generate initial positions and step length parameters, as follows:

[0130] Step 211: calculate the sum Sum of all pixels of the original image P, and the calculation formula is as follows:

[0131]

[0132] wherein P(i,j) represents the pixel value of position (i,j) in the original image P;

[0133] Step 212: calculate the sum SumLbp of all pixels of the LBP texture spectrum image Plbp, and the calculation formula is as follows:

[0134]

[0135] wherein Plbp(i,j) represents the pixel value of position (i,j) in the LBP texture spectrum image Plbp;

[0136] Step 213: set MP=mod(Sum,M) and MStep=mod(SumLbp,M);

[0137] Step 214: set NP=mod(SumLbp,N) and NStep=mod(Sum,N);

[0138] wherein MP and NP are the initial positions in the length and width directions respectively, MStep is the step length in the length direction, and NStep is the step length in the width direction;

[0139] Step S22, generate a Joseph sequence Row with a length of M, as follows:

[0140] Step 221: initialize the vector A=[1,2,…,M];

[0141] Step 222: Set Row(l) = MP and delete Row(l) from A, Row(l) means the first element in Row;

[0142] Step 223: Circularly shift MStep steps from the position deleted previously and assign the current value to Row(2);

[0143] Step 224: MStep = MStep + 1;

[0144] Step 225: Repeat steps 223 and 224 until all values in A are assigned to Row;

[0145] Step S23, generate a Josephus matrix Col with size MxN, as follows:

[0146] Step 231: For the ith row, initialize vector B = [1, 2, …, N];

[0147] Step 232: Set Col(i, 1) = NP and delete Col(i, 1) from B; Col(i, 1) means the first column element of the ith row in matrix Col;

[0148] Step 233: Circularly shift NStep steps from the position deleted previously and assign the current value B(j) to Col(i, 2);

[0149] Step 234:

[0150] Step 235: Repeat steps 233 and 234 until all values in B are assigned to Col(i, :);

[0151] Step 236: Set NP = Col(i, N);

[0152] Step S24, rearrange the ith row pixels of image Q according to the position sequence Index(i, :),

[0153] Index(i, :) = {(Row(Col(i, 1)) + i, Col(i, 1)), …, (Row(Col(i, k)) + i, Col(i, k)),

[0154] (Row(Col(i, k+1)) + i, Col(i, k+1)), …, (Row(Col(i, N)) + i, Col(i, N))

[0155] In particular, if Row(Col(i, k)) + i > M,

[0156] Row(Col(i, k)) + i = mod(Row(Col(i, k)) + i, M).

[0157] Step S25, repeat steps S23 to S24 until all pixels complete row and column synchronization scrambling operation, get scrambled image D.

[0158] Take 4x4 matrix as an example, the adaptive variable length Josephus scrambling process is as shown in Figure 6 The following is explained:

[0159] Step 1, generate initial position and step length parameters, as follows:

[0160] Calculate the sum of all pixels of the plaintext image Q

[0161] Calculate the sum of all pixels of the texture spectrum image Qlbp

[0162] Set MP = mod(75, 4) = 3, MStep = mod(1034, 4) = 2;

[0163] Set NP = mod(1034, 4) = 2, NStep = mod(75, 4) = 3;

[0164] Step 2, generate Josephus sequence Row with length M, as follows:

[0165] Initialize vector A = [1, 2, 3, 4], Row(1) = 3, delete 3 from A, now A = [1, 2, 4];

[0166] MStep = 2, circularly shift 2 steps, Row(1) = 1, delete 1 from A, now A = [2, 4];

[0167] MStep = 3, circularly shift 3 steps, Row(1) = 4, delete 4 from A, now A = [2];

[0168] MStep = 4, circularly shift 4 steps, Row(1) = 2, delete 2 from A, now A = [];

[0169] Row = [3, 1, 4, 2];

[0170] Step 3, generate Josephus sequence Col with size MxN, as follows:

[0171] For the first row i = 1, initialize vector B = [1, 2, 3, 4], Col(1, 1) = 2, delete 2 from B, now B = [1, 3, 4];

[0172] NStep = 3, circular shift by 3 steps, Col(l,2) = 1, remove 1 from B, now B = [3,4];

[0173] NStep = 2, circular shift by 2 steps, Col(l,3) = 4, remove 4 from B, now B = [3];

[0174] NStep = 3, circular shift by 3 steps, Col(l,4) = 3, remove 3 from B, now B = [];

[0175] Col(l,:) = [2, 1, 4, 3];

[0176] For the second row, i = 2, initialize vector B = [1,2,3,4], Col(2,1) = Col(l,4) = 3, remove 3 from B, now B = [1,2,4];

[0177] NStep = 1, circular shift by 1 step, Col(2,2) = 4, remove 4 from B, now B = [1,2];

[0178] NStep = 2, circular shift by 2 steps, Col(2,3) = 2, remove 2 from B, now B = [1];

[0179] NStep = 1, circular shift by 1 step, Col(2,4) = 1, remove 1 from B, now B = [];

[0180] Col(2,:) = [3, 4, 2, 1];

[0181] For the third row, i = 3, initialize vector B = [1,2,3,4], Col(3,1) = Col(2,4) = 1, remove 1 from B, now B = [2,3,4];

[0182] NStep = 3, circular shift by 3 steps, Col(3,2) = 4, remove 4 from B, now B = [2,3];

[0183] NStep = 3, circular shift by 3 steps, Col(3,3) = 2, remove 2 from B, now B = [3];

[0184] NStep = 4, circular shift by 4 steps, Col(3,4) = 3, remove 3 from B, now B = [];

[0185] Col(3,:) = [1, 4, 2, 3];

[0186] For the fourth row, i = 4, initialize vector B = [1,2,3,4], Col(4,1) = Col(3,4) = 3, remove 3 from B, now B = [1,2,4];

[0187] NStep = 3, cyclic shift 3 steps, Col(4,2) = 2, delete 2 from B, now B = [1,4];

[0188] NStep = 2, cyclic shift 2 steps, Col(4,3) = 1, delete 1 from B, now B = [4];

[0189] NStep = 1, cyclic shift 1 step, Col(4,4) = 4, delete 4 from B, now B = [].

[0190] Col(4,:) = [3,2,1,4];

[0191] Col = [2,1,4,3; 3,4,2,1; 1,4,2,3; 3,2,1,4].

[0192] In an embodiment of the present application, the scrambled image D is subjected to block-level closed-loop diffusion to obtain the ciphertext image C, and the specific implementation process is as follows:

[0193] Step S31, taking x1, y1, r1 as initial values, two chaotic matrices Z and W of size 16x16 are generated by using the 2D-LSCM chaotic system iteration, and chaotic blocks G, u, v used for diffusion are generated based on Z and W, as follows:

[0194]

[0195]

[0196]

[0197] wherein, 1≤k≤16, 1≤l≤16, {e,f} represents the index of the chaotic block element in G, k and l represent the row index and column index in each chaotic block respectively, and the index in G corresponds to the index to be diffused in the current plaintext block D.

[0198] In particular, u, v are of size 16x16, and are used to generate the first ciphertext block and update the first ciphertext block.

[0199] Step S32, the scrambled image D is divided into 16x16 small blocks, which can be expressed as:

[0200]

[0201] The block-level diffusion is performed according to the following formula:

[0202]

[0203] ​Step S33, when all sub-blocks are diffused in the way of step S32, the first ciphertext block is updated using the chaotic block v, the first ciphertext block and the last ciphertext block of the block-level diffusion to realize closed-loop diffusion, and the final ciphertext image C is obtained, and the first ciphertext block C{1,1} is updated as follows:

[0204]

[0205] The application further provides an image encryption device based on LBP coding adaptive division, which is used for realizing the image encryption method based on LBP coding adaptive division.

[0206] The coding module is configured to code the original image P to obtain an LBP texture spectrum image Plbp.

[0207] The computing module is configured to calculate a proportion U_LBP of the number of pixel points with a jump number of 2 in the LBP texture spectrum image Plbp to the total number of pixel points in the LBP texture spectrum image Plbp, and divide the LBP texture spectrum image Plbp into sub-blocks of the same size, calculate a proportion u_block of the number of pixel points with a jump number of 2 in each sub-block to the total number of pixel points in the sub-block, and the jump number refers to the number of times that the corresponding cyclic binary number in the LBP texture spectrum image Plbp changes from 0 to 1 or from 1 to 0.

[0208] The identifying module is configured to compare the proportion u_block calculated based on the sub-blocks with the proportion U_LBP calculated based on the LBP texture spectrum image Plbp, identify important sub-blocks, add the important sub-blocks to the matrix PA, and add the sub-blocks not identified as important sub-blocks to the matrix PB.

[0209] The diffusion module is configured to diffuse the matrix PA to obtain a matrix TC.

[0210] The merging module is configured to merge the matrix TC and the matrix PB, and convert the merged matrix into an image Q of the size of the original image.

[0211] The shuffling module is configured to perform adaptive variable-length Joseph shuffling on the image Q to obtain a shuffled image D.

[0212] The encryption module is configured to perform block-level closed-loop diffusion on the shuffled image D to obtain a final ciphertext image C.

[0213] It is worth pointing out that the device embodiment corresponds to the method embodiment, and the implementation manners of the method embodiment are applicable to the device embodiment and can achieve the same or similar technical effects, so the device embodiment will not be described here.

[0214] Those skilled in the art will appreciate that embodiments of the application can be devised for a method, a system, or a computer program product. Accordingly, the present application can be embodied in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code.

[0215] The present application is described in reference to the flowchart illustrations and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0216] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0217] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0218] The above description is only preferred embodiments of the application. It should be pointed out that, for those skilled in the art, some improvements and modifications can be made without departing from the technical principles of the application, and these improvements and modifications should also be considered as falling within the scope of the application.

Claims

1. An image encryption method based on LBP coding and adaptive partitioning, characterized in that, include: LBP encoding is performed on the original image P to obtain the LBP texture map Plbp; Calculate the proportion U_LBP of the number of pixels in the LBP texture map Plbp with a transition count of 2 to the total number of pixels in the entire LBP texture map Plbp; and divide the LBP texture map Plbp into sub-blocks of the same size, and calculate the proportion u_block of the number of pixels in each sub-block with a transition count of 2 to the total number of pixels in the sub-block; the transition count refers to the number of times the corresponding cyclic binary number in the LBP texture map Plbp changes from 0 to 1 or from 1 to 0. The ratio u_block calculated based on the sub-block is compared with the ratio U_LBP calculated based on the entire LBP texture spectrum Plbp to identify important sub-blocks, and important sub-blocks are added to matrix PA, while sub-blocks not identified as important sub-blocks are added to matrix PB. The matrix PA is diffused to obtain the matrix TC, including: Select initial values ​​and use a 2D-LSCM chaotic system to iteratively generate a chaotic sequence S of length 256×count, where count is the number of important sub-blocks; The chaotic sequence S is sorted in ascending order using the sort function to obtain the index sequence O; The matrix PA is transformed into a one-dimensional sequence T using the reshape function, and then diffused using the index sequence O to obtain a one-dimensional sequence TC: ; in, Represents the first in a one-dimensional sequence TC One element, Describes the first element in a one-dimensional sequence T. One element, This represents the XOR operation. Describes the first element in a one-dimensional sequence T. One element, Represents the first index in index sequence O One element, Represents the first chaotic sequence S. One element, It is the number of allowed pixel values ​​in a plaintext image, operator It returns the largest integer less than or equal to X; The one-dimensional sequence TC is transformed into a 16×16 count matrix TC using the reshape function; The matrix TC and the matrix PB are merged and transformed into an image Q of the original image size; The image Q is subjected to an adaptive variable-length Josephus scrambling operation to obtain a scrambled image D, including: Step S21: Generate the initial position and step size parameters in the length and width directions; Step S22: Generate a length of [value] based on the initial position and step size parameters in the length direction. The Josephus sequence Row; Step S23: Generate a size based on the initial position and step size parameters in the width direction. The Josephus matrix Col; The size of the original image P; Step S24: Transfer the first image Q to the image Q. The row pixels are rearranged as follows: , if ,but, ; Step S25: Repeat steps S23 to S24 until all pixels have completed the row and column synchronization scrambling operation, and obtain the scrambled image D. The scrambled image D is subjected to block-level closed-loop diffusion to obtain the final ciphertext image C, including: Select initial values ​​and use a 2D-LSCM chaotic system to generate two chaotic systems of size . Chaotic matrix and ,based on and Generate chaotic blocks , , ,as follows: ; ; ; Where, 1≤ ≤ ,1≤ ≤ ,1≤ ≤16, 1≤ ≤16, express Index of chaotic block tuples and These represent the row index and column index within each chaotic block, respectively. The indices in the table all correspond to the indices that need to be diffused in the current plaintext block D; Divide the scrambled image D into 16×16 blocks, represented as follows: , Block-level diffusion is performed according to the following formula: ; Using chaotic blocks The first ciphertext block and the last ciphertext block of the block-level diffusion process update the first ciphertext block to perform closed-loop diffusion, resulting in the final ciphertext image C. The first ciphertext block... The update method is as follows: 。 2. The image encryption method based on LBP coding adaptive partitioning according to claim 1, characterized in that, The LBP texture spectral map Plbp is divided into sub-blocks of the same size, including: The LBP texture map Plbp is divided into sub-blocks of size 16×16, and the total number of sub-blocks is... for: ; in, The size of the original image P.

3. The image encryption method based on LBP coding adaptive partitioning according to claim 2, characterized in that, The ratio u_block calculated based on the sub-blocks is compared with the ratio U_LBP calculated for the entire image to identify important sub-blocks, including: Compare the calculated proportion u_block of each sub-block with U_LBP. If u_block ≥ U_LBP, then the sub-block is an important sub-block; otherwise, it is not an important sub-block.

4. The image encryption method based on LBP coding adaptive partitioning according to claim 3, characterized in that, The initial position and step size parameters in the length and width directions include: , ; , ; in, and These are the initial positions in the length and width directions, respectively. The step size is in the length direction. The step size is in the width direction. Original image The sum of all pixels, It is the sum of all pixels in the LBP texture spectrum Plbp.

5. The image encryption method based on LBP coding adaptive partitioning according to claim 4, characterized in that, The initial position and step size parameters generated based on the length direction have a length of [missing information]. The Josephus sequence Row includes: Step 221: Initialize vector A = [1, 2, ..., ... ]; Step 222: Settings and from Delete ,in It refers to the first element in the row; Step 223: Starting from the deletion position, perform a cyclic shift. Step and assign the current value to ; Step 224: Update the step size to: ; Step 225: Repeat steps 223 and 224 until... All values ​​in the array are assigned to Row.

6. The image encryption method based on LBP coding adaptive partitioning according to claim 4, characterized in that, The generation of the Josephus matrix Col of size M×N based on the initial position and step size parameters in the width direction includes: Step 231: For the first Row, initialize vector B=[1,2,…,N]; Step 232: Settings And delete from B ; Represents the first digit of matrix Col. The element in the first column of the row; Step 233: Starting from the deletion position, perform a cyclic shift. Step and the current value B ( ) assigned to ; Step 234: Update the step size to: +1; Step 235: Repeat steps 233 and 234 until all values ​​in B have been assigned. ( ,:); Step 236: Update for: .

7. An image encryption device based on LBP coding adaptive partitioning, characterized in that, The apparatus for implementing the image encryption method based on LBP coding adaptive partitioning as described in any one of claims 1 to 6, the apparatus comprising: The encoding module is used to perform LBP encoding on the original image P to obtain the LBP texture map Plbp; The calculation module is used to calculate the proportion U_LBP of the number of pixels in the LBP texture map Plbp with a transition count of 2 to the total number of pixels in the entire LBP texture map Plbp, and to divide the LBP texture map Plbp into sub-blocks of the same size, and calculate the proportion u_block of the number of pixels in each sub-block with a transition count of 2 to the total number of pixels in the sub-block; the transition count refers to the number of times the corresponding cyclic binary number in the LBP texture map Plbp changes from 0 to 1 or from 1 to 0; The identification module is used to compare the ratio u_block calculated based on the sub-block with the ratio U_LBP calculated based on the entire LBP texture spectrum Plbp, identify important sub-blocks, and add important sub-blocks to matrix PA and add sub-blocks that are not identified as important sub-blocks to matrix PB. A diffusion module is used to diffuse the matrix PA to obtain the matrix TC; The merging module is used to merge the matrix TC and the matrix PB, and convert them into an image Q of the original image size; The scrambling module is used to perform an adaptive variable-length Josephus scrambling operation on the image Q to obtain a scrambled image D; An encryption module is used to perform block-level closed-loop diffusion on the scrambled image D to obtain the final ciphertext image C.

Citation Information

Patent Citations

  • Image encryption method based on Y-shaped filling curve and variable-step Josephh traversal

    CN112202545A

  • Image texture identification method and system

    CN113963041A