Brief introduction of Reversible Data Hiding in Encrypted Images with Two-MSB Prediction Encrypted Image Reversible Information Hiding Algorithm

The method used for error prediction

1. Median Predictor

Use the median predictor MED (Median Edge Detector) to predict the predicted value px of x for the three adjacent pixels on the left, upper and upper left of x in the figure.

2. The bitmap generated according to the prediction error (Location binary map)

Bitmap (Location binary map) can be understood as a map that records the wrong location/a map that can find the predicted wrong location.

The bitmap here marks the prediction error of the first two MSBs of the original value x and the predicted value px.

In mathematical terms, it is:

The source of pasted papers is different. Note that this p actually has the same meaning as px in the above, and both refer to the predicted value

 Then check to see x^{MSB} if p^{MSB}it is equal, if it is the same, the bitmap is marked as 0, otherwise it is marked as 1.

Two-image encryption principle

1. Image encryption principle

For a single pixel:

The pixel location is (i, j).

First convert the pixels in the range 0 to 255 to binary. Mathematically, it is:

 The lower brackets mean rounding down, and mod means taking the remainder.

Then use the encryption key to generate a pseudo-random sequence r^k_{(i,j)}, and the length can be calculated. For a single-channel grayscale image of size (M, N), the length of the random sequence is 8MN.

Execute XOR with the encrypted sequence and the image to obtain the encrypted image e^k_{(i,j)}.

ⓧ means bitwise XOR

It goes without saying that the decimal representation of the encrypted image can be calculated.

 2. It is recommended to use Logistic chaotic encryption for beginners

Paste the code directly:

def crypt(im, miu, x0):
    '''
    logistic混沌加密
    :param im: 待加密图像
    :param miu: μ参数
    :param x0: x0参数
    :return: 返回密文图像
    '''
    h, w = im.shape
    c_ = np.zeros_like(im)
    c_[0][0] = x0
    c=[]
    c.append(x0)
    result = np.zeros_like(im)
    result[0][0] = (x0 * pow(2, 48)) % 256
    for x in range(1, h * w):
        i = x // w
        j = x % w
        c.append(miu * c[x - 1] * (1 - c[x - 1]))
        c_[i][j] = (c[x] * pow(2, 48)) % 256
    for i in range(h):
        for j in range(w):
            result[i][j] = im[i][j] ^ c_[i][j]
    return result

Just a few things to note :

To ensure the encryption effect, the miu parameter and x0 parameter must be in the following range:

0 < X_0 < 1

3.5699456...< \mu <=4

Three-embedded block principle and error labeling method

Because the image compresses information in a predictive way, the easiest way to think of it is to embed information where the prediction is correct, mark errors where the prediction is wrong, and wait for the algorithm to process, so that the subsequent non-destructive restoration of the image can be carried out. For the identification of the boundary position between the correct part and the wrong part, the block method can be used to deal with it. In fact, this article does just that.

Blocking: The scanning order is from left to right and from top to bottom, and 4 pixels form a group during scanning.

Error mark: If there is a prediction error, the block before and after the error position will be processed, and the 8 MSBs of the 4 pixels in the front and back blocks will be set to 1, as shown in the figure:

In this way, when encountering the same block, the probability of error is 1/2^{8}.

Four embedding process

Encrypt with the image encryption key K_eto obtain an encrypted image E^{'}, in which each pixel is e^{'}_{(i,j)}, and then determine whether it is an embeddable block according to the tags in the bitmap, and if it is embeddable, embed the 8 MSBs of 4 pixels in the block. The embedded formula is as follows:

Note that the first row and column do not embed information since we used a median predictor.

 V. Information Extraction and Image Lossless Restoration

3 situations:

1. Only the image encryption key K_e, you can only restore the image losslessly

First, use the image encryption key to generate a decryption sequence, and then perform an XOR operation with the image bit by bit. In short, it operates according to the principle of image encryption. The specific mathematical formula is as follows:

ⓧ means bitwise XOR

 Compared to the original image, only the embedded secret information and mislabeled places will be different.

The part of embedding secret information, since it can be embedded, naturally there is no prediction error, just embed its 2-bit MSB directly according to the result of median prediction.

If the wrong place is marked, just make changes according to the marked situation.

2. Only information hiding key K_w, then you can only extract secret information

Scan all the pixels except the first row and the first column by block, and then identify the error according to the principle of error marking, and extract the rest as secret information.

K_wThen process the extracted information with your existing information hiding key to get the secret information which can be read after decryption.

3. If you have two keys K_e, K_wyou can restore the image without loss and extract the complete secret information. Refer to the above for specific steps.

Guess you like

Origin blog.csdn.net/m0_46948660/article/details/129838056