Bit-plane decomposition:
The gray levels of the image can be represented by
For better compression result, it is desirable for the sequences of consecutive 1's or 0's in the binary images to be as long as possible. However, one problem one may encounter is that the values of many of the bit planes may change, even though the gray level of the n-bit image changes very little, such as in a smooth region of the image.
Example:
To improve, the binary coding of the N gray levels can be converted to Gray code which guarantees only one of the bit plane will change when the gray level changes continuously.