%================ Bit Plane Slicing Program =================% A=imread('bit_plane_img.tif'); subplot(3,3,1),imshow(A),title('INPUT IMAGE'); for i=1:8 B=bitplaneslicing(A,i); subplot(3,3,i+1),imshow(B),title(i); end %====================================================% %================ Bit Plane Slicing Function =================% function [ B ] = bitplaneslicing( A ,n) % function for n bit plane slicing where n<=8 [M,N]=size(A); B=zeros(M,N); for i = 1:M for j = 1:N str=dec2bin(A(i,j),8); if strcmp(str(9-n),'0') B(i,j)=0; else B(i,j)=2^(n-1); end end end end %====================================================% Input Image: bit_plane_img.tif Output Image: