image and text steganography

can any one correct this code please ?
this code hide the input message text in the cover image but the encoded message is not the input text (embedded text)
Simple Wavelet Steganography: Hide Message in Image using wavelet Transform Code MATLAB :
%%%%%%%%%%%%%%Encoding.m
clear
close all
clc
im=imread('cameraman.tif');
wname='haar';
msg='Grasshopper Network';
data=[];
for(i=1:length(msg))
d=msg(i)+0;
data=[data d];
end
imshow(im);
[cA1,cH1,cV1,cD1] = dwt2(im,wname);
dec1 = [cA1 cH1; cV1 cD1 ];
figure;imshow(uint8(dec1));
M=max(data);
data_norm=data/M;
n=length(data);
[x y]=size(cH1);
cH1(1,1)=-1*n/10;
cH1(1,2)=-1*M/10;
for(i=1:1:ceil(n/2))
cV1(i,y)=data_norm(i);
end
for(i=ceil(n/2)+1:1:n)
cD1(i,y)=data_norm(i);
end
CODED1=idwt2(cA1,cH1,cV1,cD1,wname);
figure;imshow(uint8(CODED1))
[x y]=size(cA1);
imshow(uint8(CODED1))
ms=abs(CODED1-double(im));
ms=ms.*ms;
ms=mean(mean(ms))
ps= (255*255)/ms;
ps=10*log10(ps)
imwrite(uint8(CODED1),'Stego.bmp','bmp');
return
%%%END of encoding.m%%%%%%%%%%%%%%%%
%%%%%Decoding.m%%%%%%%%%%%%%%%%%
im=imread('Stego.bmp');
[cA11,cH11,cV11,cD11] = dwt2(CODED1,wname);
data=[]
data_norm=[];
n=ceil(abs(cH11(1,1)*10));
M=ceil(abs(cH11(1,2)*10));
for(i=1:1:ceil(n/2))
data_norm(i)=cV11(i,y);
end
for(i=ceil(n/2)+1:1:n)
data_norm(i)=cD11(i,y);
end
data=ceil(data_norm*M)-1;
msg='';
for(i=1:length(data))
msg=strcat(msg,data(i));
end
msg

6 件のコメント

Geoff Hayes
Geoff Hayes 2014 年 10 月 27 日
編集済み: Geoff Hayes 2014 年 10 月 27 日
eng - when you say that the encoded message is not the input text do you mean that the decoded message is not Grasshopper Network, but something else? Is it Fq`rrgnoodqMdsvnqj instead?
eng
eng 2014 年 10 月 27 日
yes,i mean this sorry the decoded text is not the same the encoded text some letters is not correct
Geoff Hayes
Geoff Hayes 2014 年 10 月 27 日
What does the decoded text look like?
eng
eng 2014 年 10 月 28 日
when i have entred the encoded text 'Grasshopper Network' the decoded text is 'GqasshnooeqNesvnqj'
and any input text the decoded also is not the same
Image Analyst
Image Analyst 2014 年 10 月 28 日
Attach your m-file with the paperclip icon, or read this.
Geoff Hayes
Geoff Hayes 2014 年 10 月 28 日
So some of the characters in the decoded message are off by one. This could be due to the fact that the encoded image, CODED1, is cast as uint8 before being written to file, and then the decoded message is obtained as
data=ceil(data_norm*M)-1;
The subtraction of one works for some of the characters in the message (mapping them back to their original value) while it fails for others. You could contact the author of the code (copied from here), as there seems to be some known problems with the decoding.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEncryption / Cryptography についてさらに検索

質問済み:

eng
2014 年 10 月 26 日

編集済み:

2016 年 1 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by