% Fig. 3.14
% Bit-plane Slicing
% Dr. W.D.Pan, UAH
warning('off','images:initSize:adjustingMag');
clear all;
close all;

I = imread('Fig0314(a)(100-dollars).tif');
imshow(I);

% Output bitplane image
bit_index = 6;

J = bitget(I, bit_index);
figure;
imshow(J,[]);

% Reconstruction using bit planes
bit_index = 7;
J7 = bitget(I, bit_index);
bit_index = 8;
J8 = bitget(I, bit_index);
J_recon = uint8(zeros(500, 1192));
J_recon7 = bitset(J_recon, 7, J7);
J_recon7_8 = bitset(J_recon7, 8, J8);






