How to Reconstruct an Image using bit plane. I have already separated all the bit layers of the image using for loops and bitget ?

3 views (last 30 days)
if true
% code
endclc;
close all;
clear all;
I=imread('car.jpg');
Im=I(:,:,1);
figure
[r,c]=size(Im);
s=zeros(r,c,8);
for k= 1:8
for i=1:r
for j=1:c
s(i,j,k)=bitget(Im(i,j),k);
end
end
end
subplot(3,3,1) MSB=s(:,:,8); imshow(MSB) title('8th Bit/MSB Layer ')
subplot(3,3,2) Bit7=s(:,:,7); imshow(Bit7) title('7th Bit Layer ')
subplot(3,3,3) Bit6=s(:,:,6); imshow(Bit6) title('6th Bit Layer ')
subplot(3,3,4) Bit5=s(:,:,5); imshow(Bit5) title('5th Bit Layer ')
subplot(3,3,5) Bit4=s(:,:,4); imshow(Bit4) title('4th Bit Layer ')
subplot(3,3,6) Bit3=s(:,:,3); imshow(Bit3) title('3rd Bit Layer ')
subplot(3,3,7) Bit2=s(:,:,2); imshow(Bit2) title('2nd Bit Layer ')
subplot(3,3,8) LSB=s(:,:,1); imshow(LSB) title('LSB Layer ')

Accepted Answer

Image Analyst
Image Analyst on 1 Jul 2018
Just multiply and add
uint8Image = uint8(LSB + 2*Bit2 + 4*Bit3 + 8*Bit4 + 16*Bit5 + 32*Bit6 + 64*Bit7 + 128*MSB);

More Answers (0)

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!