Note:-Write this code in Matlab
CODE
%Bit plane slicing
clear all ;
clc;
a=imread('saturn.tif');
a=double(a);
r=input('Which Bit Image Do You Want To See 1=MSB 8=LSB');
[row,col]=size(a);
for x=1:1:row
for y=1:1:col
c=dec2bin(a(x,y),8);%Converts Decimal To Binary
d=c(r);
w(x,y)=double(d);%%Since w is Char and cannot Be Plotted
if w(x,y)==49%%Since Double Of d will be either 49 or 48
w(x,y)=255;
else
w(x,y)=0;
end
end
end
figure(1);
imshow(uint8(a));
figure(2);
imshow(uint8(w));
how can we reverse this? as in join the bit-planes to obtain original image?
ReplyDelete