3.1. Two-Tier Bit-Flipping Embedding Strategy
Given a grayscale image of size , the pixels are represented by . As the grayscale image allows 256 distinct intensities, each pixel can be transformed as an 8-bit pixel binary bitstream . The secret data are embedded into the grayscale image using a two-tier bit-flipping embedding strategy as follows:
Step 1: Assign the grayscale image into two cover images and .
Step 2: Divide the secret data into two-bit secret segments.
Step 3: Read pixels from the corresponding locations of the two cover images and to form the pixel pairs .
Step 4: Embed two secret segments into each pixel pair using the two-tier bit-flipping embedding strategy.
Step 4.1: Embed the first secret segment into the pixel pair by the first-tier embedding resulting in the updated pixel pair .
Step 4.2: Embed the second secret segment into the updated pixel pair by the second-tier embedding resulting in the stego pixel pair .
Step 5: Repeat Step 4 until all pixel pairs are processed.
Step 6: Backfill with the stego pixel pairs to their corresponding positions in the two stego images, and .
The rules for the first-tier and the second-tier embeddings are provided in Algorithms 1 and 2, respectively. Here,
flips the bit
,
sets the bit
to the value
,
returns the updated value
after processing
, and
represents the exclusive-or operation. In essence, our two-tier bit-flipping embedding strategy involves executing the bit-flipping within a pixel pair to embed secret data. In the first-tier embedding, we may flip bit
, bit
, or both
and
bits depending on the values of the secret bits illustrated in
Figure 3a. Consequently, the updated pixel pair
is obtained. Moving to the second-tier embedding, bit flips occurred among
,
,
and
bits are depicted in
Figure 3b. Note that the 7-th bits of the pixel pair may undergo bit flipping in both tiers. To indicate the state of the bit 7 after the first-tier embedding,
serves as a label before the bit-flipping in the second tier by checking whether
and
are the same or not. That is,
when
and
when
. The second-tier embedding results a stego pixel pair
. After processing all pixel pairs, the resulting stego pixel pairs are backfilled into their corresponding positions in the stego images
and
. The two stego images are totally transmitted to two recipients
and
afterwards, each of whom is aware of the specific stego image they receive (see Algorithms 1 and 2).
Algorithm 1: The first-tier embedding. |
Input: | Original pixel pair ( and the first secret segment . |
Output: | Updated pixel pair . |
1: | If |
2: |
|
3: | Else if |
4: |
|
5: | Else if |
6: |
|
7: | Else if |
8: |
|
9: | End |
Algorithm 2: The second-tier embedding. |
Input: | Updated pixel pair and the second secret segment . |
Output: | Stego pixel pair . |
1: | If |
2: |
|
3: | Else if |
4: |
|
5: | Else if |
6: |
|
7: | Else if |
8: |
|
9: | End |
To illustrate the process of the two-tier bit-flipping embedding, we present two examples in
Figure 4. In
Figure 4a, the given pixel pair
is utilized to embed the secret segments “01” and “10”. We first embed the secret segment “01” into the pixel pair by flipping
. The first tier embedding leads to the updated pixel pair
. Subsequently, we set
, indicating that
. Following this, the secret segment “10” is embedded by flipping
. The second-tier embedding yields the stego pixel pair
. In
Figure 4b, the given pixel pair
is employed to embed the secret segments “10” and “11”. The embedding process begins by flipping
to embed the secret segments “10”. This operation results in the updated pixel pair
. Since
, we then set
. The stego pixel pair
is attained by flipping
and
.
3.2. Data Extraction and Image Recovering
Despite the recipients receiving their stego images, they are incapable of discerning any information about the secret data. Only when mutual trust is established between the two recipients, they can extract the secret segments accurately and recover the original grayscale image losslessly. In this section, it is assumed that the two recipients and have established mutual trust. The process of data extraction and image recovery is as follows:
Step 1: Read pixels from the corresponding positions of the two stego images and to form pixel pairs .
Step 2: Extract two secret segments from each stego pixel pair and retrieve the original pixel pair.
Step 2.1: Extract the second secret segment from the stego pixel pair and retrieve the updated pixel pair .
Step 2.2: Extract the first secret segment from the updated pixel pair and retrieve the original pixel pair .
Step 3: Repeat Step 2 until all pixel pairs have been processed.
Step 4: Concatenate all the extracted secret segments to obtain the secret data.
Step 5: Backfill the original pixel pairs into their corresponding positions to generate two cover images and .
Step 6: Choose one of the cover images to serve as the original grayscale image .
The rules of data extraction and image recovery are provided in Algorithms 3 and 4, respectively. Essentially, the data extraction and image recovery are the inverse process of data embedding. Therefore, we initially extract the secret segments and retrieve the pixel pair from the second tier, followed by the first tier. In the second tier, we begin by evaluating the patten of
,
,
,
and
to determine the flipped bits within
,
,
and
, as illustrated in
Figure 5a. Note that
indicates the state of the 7-th bits before the second-tier embedding. After confirming the pattern, we extract the embedded secret segment
, reflip the flipped bits, and set
to the value of
. These steps lead to the updated pixel pair
. In the first-tier, we extract the embedded secret segment
and reflip the flipped bits of
,
,
and
to obtain the original pixel pair
, as shown in
Figure 5b. After processing all pixel pairs, the resulting stego pixel pairs are backfilled into their corresponding positions, thus generating the cover images
and
. Finally, the secret segments are concatenated to form secret data and one of the cover images
and
are used as the original cover image
.
It is important to emphasize that neither recipient can independently extract the secret data or recover the original image. Both recipients must collaborate and share their stego images
and
to accurately retrieve the embedded secret segments and restore the original pixel pairs. Additionally, any attempt by either recipient to alter the pixel values within their respective stego images will lead to failures of the data extraction and image recovery processes. This interdependent mechanism significantly enhances the reliability and security of our method, ensuring that the embedded secret data remain protected and the original image can only be accurately recovered through the cooperation and mutual trust of both recipients (see Algorithms 3 and 4).
Algorithm 3: The second-tier secret data extraction and pixel pair retrieve. |
Input: | Stego pixel pair . |
Output: | Updated pixel pair and the second secret segments . |
1: | If ( || ( |
2: |
. |
3: |
|
4: | Else if ( || ( |
5: |
. |
6: |
|
7: | Else if ( || ( |
8: |
.
|
9: |
|
10: | Else if ( || |
11: |
.
|
12: |
|
13: | End |
Algorithm 4: The first-tier secret data extraction and pixel pair retrieve. |
Input: | Updated pixel pair . |
Output: | Original pixel pair and the first secret segments . |
1: | If |
2: |
.
|
3: |
|
4: | Else if |
5: |
.
|
6: |
|
7: | Else if |
8: |
.
|
9: |
|
10: | Else if |
11: |
.
|
12: |
|
13: | End |
To illustrate the process of the data extraction and image recovery, we present two examples in
Figure 6. In
Figure 6a, we extract the secret segments and retrieve original pixel pair from the given pixel pair
. Due to
,
and
, we extract the secret segment “10” and flip
. Subsequently, we set
to the value of
. Through these steps, we obtain the updated pixel pair
. Based on
and
, we then extract the secret segment “01” and flip
and generate the original pixel pair
. For the pixel pair
in
Figure 6b, we first extract the secret segment “11”, flip
and
, and set
to the value of
. After these procedures, we obtain the updated pixel pair
. Based on
and
, we extract the secret segment “10” and flip
and generate the original pixel pair
.
3.3. Distortion Discussion
In essence, our approach accomplishes data embedding by flipping the 6th, 7th, and 8th bits of the pixel pairs obtained from the cover images and . In our embedding strategy, we assume a uniform distribution of 0s and 1s in the secret data, implying that the probabilities of our secret segments being “00”, “01”, “10”, and “11” are equal. For our method, the maximum distortion for the pixel is 7 occurring when “01” is embedded in the first tier, followed by the embedding of “11” in the second tier with non-canceling flips. In this case, the distortion for is 0. Additionally, the maximum distortion for is 15, happening when “11” is embedded for the first time, followed by “10”, and the flips are non-canceling. In this case, the distortion for is 0. Except for the above two cases, the embedding flips result in minor distortions. Therefore, we believe that our approach will result in an acceptable level of distortion. Moreover, we suggest re-evaluating the flipping strategy in cases which the distributions of 0s and 1s of the secret data are not equally distributed with one value occurring more frequently. This redesign is intended to further optimize the impact of bit-flipping on image quality.