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 (최근 30일)
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 ')

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by