%function lsb_2bit()
clc
close all
im=imread('cameraman.tif');
s='Ali Reza Zahedpoor Ali Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza ZahedpoorAli Reza Zahedpoor';
figure, imshow(im), title('Original Image');
Byte_LSB=0;
for i=1:length(s) %For All Character in the Text Message
sb=dec2bin(s(i),9) % Convert Each Char to Binary
for j=1:3:9 % Embedding All Binary Digits in to Image From Byte_LSB
Byte_LSB=Byte_LSB+1 ;
k=dec2bin(im(Byte_LSB));
if sb(j)=='0' & sb(j+1)=='0' & sb(j+2)=='0'
k(8)='0';
k(7)='0';
k(6)='0';
end;
if sb(j)=='1' & sb(j+1)=='0' & sb(j+2)=='0'
k(8)='1';
k(7)='0';
k(6)='0';
end;
if sb(j)=='0' & sb(j+1)=='1' & sb(j+2)=='0'
k(8)='0';
k(7)='1';
k(6)='0';
end;
if sb(j)=='1' & sb(j+1)=='1' & sb(j+2)=='0'
k(8)='1';
k(7)='1';
k(6)='0';
end;
if sb(j)=='0' & sb(j+1)=='0' & sb(j+2)=='1'
k(8)='0';
k(7)='0';
k(6)='1';
end;
if sb(j)=='1' & sb(j+1)=='0' & sb(j+2)=='1'
k(8)='1';
k(7)='0';
k(6)='1';
end;
if sb(j)=='0' & sb(j+1)=='1' & sb(j+2)=='1'
k(8)='0';
k(7)='1';
k(6)='1';
end;
if sb(j)=='1' & sb(j+1)=='1' & sb(j+2)=='1'
k(8)='1';
k(7)='1';
k(6)='1';
end;
im(Byte_LSB)=bin2dec(k);
end;
end;
figure, imshow(im), title('Embedding Image');
s='';
ss='';
Byte_LSB
for i=1:Byte_LSB
temp=bitget(im(i),1:3)
s =[ s , [num2str(temp(1)) ,num2str(temp(2)) , num2str(temp(3))]]
if mod(i,3)==0
ss=[ss,char( bin2dec(s))]
s='';
end;
end;
ss
lsb_3bit.rar_LSB_hide_image steganography_lsb 3_steganography
版权申诉
51 浏览量
2022-09-21
07:40:27
上传
评论
收藏 624B RAR 举报
alvarocfc
- 粉丝: 109
- 资源: 1万+