Bit-plane splicing
An image is represented in terms of pixels. See the following image in which yellow rectangle represents pixels values at a specific position in the pointed out are in back image. The binary formats for those values (8-bit representation) are also represented in upper right rectangle, in which values in RED ellipse are lowest order bit and GREEN ones are higher order bit. Image :
These values are represented in Matlab as
>> A = [ 237 240 83 76] A = 237 240 83 76
Individual bits are retrieved as
>> B = bitget(A,1) % lowest order bit is represented as 1 B = 1 0 1 0 >> C = bitget(A,8) % highest order bit is represented as 8 C = 1 1 0 0
Let’s find out separate bit planes :
>> A = imread('desertg.jpg'); >> B=bitget(A,1); >> figure, >> subplot(2,4,1);imshow(logical(B));title('Bit plane 1'); >> B=bitget(A,2); >> subplot(2,4,2);imshow(logical(B));title('Bit plane 2'); >> B=bitget(A,3); >> subplot(2,4,3);imshow(logical(B));title('Bit plane 3'); >> B=bitget(A,4); >> subplot(2,4,4);imshow(logical(B));title('Bit plane 4'); >> B=bitget(A,5); >> subplot(2,4,5);imshow(logical(B));title('Bit plane 5'); >> B=bitget(A,6); >> subplot(2,4,6);imshow(logical(B));title('Bit plane 6'); >> B=bitget(A,7); >> subplot(2,4,7);imshow(logical(B));title('Bit plane 7'); >> B=bitget(A,8); >> subplot(2,4,8);imshow(logical(B));title('Bit plane 8');