The bit plane compression is a lossy data compression
Explain with a simple example how to encoding and decoding are carried out in bit plane compression. In this example, the MSB (most significant bit) alone is considered and encoded.
Step1: Obtain binary of the values in the image
Step2: Extract the MSB (most significant bit)
Step3: Rearrange the MSB values such that each row contains 8 columns or 8 bits
1 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
{we have 3x6=18 values but we need 8 columns in each row. It achieved by padding the matrix with zeros in the end in order to form a matrix which has 8 columns in each row.}
Step4: Convert binary in each row to decimal number
10001001 = 137 10011110 =158 11000000 = 192 |
|
|
Decompression
Step1: Our compressed data = |
|
Convert the decimal values to binary format
1 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
Step2: Remove extra zeros appended to the matrix
Step3: reshape the matrix to size of the original image.
1 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
1 |
Step4: Pre allocate a matrix of same size of original image and replace the MSB of each value in the matrix with the bit we decompressed in the previous step.
10000000 |
00000000 |
00000000 |
00000000 |
10000000 |
00000000 |
00000000 |
10000000 |
10000000 |
00000000 |
00000000 |
10000000 |
10000000 |
10000000 |
10000000 |
00000000 |
10000000 |
10000000 |
Step5: Display the final data
128 |
0 |
0 |
0 |
128 |
0 |
0 |
128 |
128 |
0 |
0 |
128 |
128 |
128 |
128 |
0 |
128 |
128 |
Original Image:
|
|
||||||||||||||||||
After applying compression and decompression: |
|