Help embedding secret message using lwt ,cannot extract the secret message correctly
Info
This question is closed. Reopen it to edit or answer.
Show older comments
please help me..here is the code that i used for embedding and extracting
and the output was as follows..
embed
1101000
extracted binary
000000
cover=imread('frame1.jpg');
els = {'p',[-0.125 0.125],0};
lshaarInt = liftwave('haar','int2int');
lsnewInt = addlift(lshaarInt,els);
[LL,LH,HL,HH] = lwt2(double(cover),lsnewInt);
dec=[...
LL,LH
HL,HH
...
];
%figure;imshow(dec,[]);title ('IWT');
secret='h';
secret_bin=dec2bin(secret);
disp(secret_bin);
secret_bin=secret_bin';
length_secret = size(secret_bin,1)*size(secret_bin,2);
length_LH = size(LH,2);
c = 1;
% embedding the secret_bin in the last signficant bit of each CA ( 1 LSB
of CA )
for b = 1:1:length_LH
if b <= length_secret
xb=LH(1,c);
if xb < 0
xb= abs(xb);
if strcmp(secret_bin(b), '0')
xb=bitset(xb,1,0);
else
xb=bitset(xb,1,1);
end
LH(1,c)=-xb;
else
if strcmp(secret_bin(b), '0')
LH(1,c) = bitset(LH(1,c),1,0);
else
LH(1,c) = bitset(LH(1,c),1,1);
end
end% end if xb<0
c = c+ 1;
if (c > length_LH)
c = 1;
end
end % if b <= length_secret
end % end for loop b=8:-1:1
stego = uint8(ilwt2(LL,LH,HL,HH,lsnewInt));
imwrite((stego),'stegoi.jpg','jpg');
figure;
imshow((stego));title('EMBEDDED OUTPUT');
%extraction
Stegoi = imread('stegoi.jpg');
els = {'p',[-0.125 0.125],0};
lshaarInt = liftwave('haar','int2int');
[LL_ex,LH_ex,HL_ex,HH_ex] = lwt2(double(Stegoi),lsnewInt);
dec=[...
LL_ex,LH_ex
HL_ex,HH_ex
...
];
length_LH_ex = size(LH_ex,2);
c = 1;
secret_bits_ex = zeros(1,length_secret);
for b = 1:1:length_LH_ex
if b <= length_secret
xb=LH_ex(1,c);
if xb < 0
xb= abs(xb);
end
secret_bits_ex(b) = bitget(xb,1);
%letter = bitset(letter,b,bitget(xb,1));
c = c + 1;
end
end
%function i created
result=secret_bits_ex;
disp("extracted binary")
disp(result);
please help me
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!