Read fractal.jpg file. Display
individual bits as binary image. Display and comment on the result. (Hint: use bitget built-in function)
CODE:
clc; clear;
A=imread('fractal.jpg');
[row,col]=size(A);
subplot(3,3,1), imshow(A), title('Original Image');
C=zeros(row,col,8);
for k=1:8
for i=1:row
for j=1:col
C(i,j,k)=bitget(A(i,j),k); %Bit slicing
end
end
subplot(3,3,k+1), imshow(C(:,:,k)), title(['Bit Plane ',num2str(k-1)]);
end
OUTPUT RESULT :
We
observe that the three higher order planes, especially the 8th bit
plane, contain a significant amount of the visually significant data. The lower
order planes contribute to more subtle intensity details in the image.
Decomposing an image into its bit planes is useful for analyzing the relative
importance of each bit in the image and is useful for image compression.