r=imread(\'z.jpg\');
r=rgb2gray(r);
q=r;
a=bitget(r,8);
b=bitget(r,7);
c=bitget(r,6);
figure(1);
subplot(4,4,[2 3 6 7]),imshow(r),title(\'original\');
subplot(4,4,[9 10]),imshow(logical(a)),title(\'bitplane 8\');
subplot(4,4,[11 12]),imshow(logical(b)),title(\'bit plane 7\');
subplot(4,4,[13 14]),imshow(logical(c)),title(\'bitplane 6\');
x=bitset(a,8,a);
y=bitset(x,7,b);
z=bitset(y,6,c);
subplot(4,4,[15 16]),imshow(z),title(\'reconstructed\');