필터 지우기
필터 지우기

image and text steganography

조회 수: 2 (최근 30일)
eng
eng 2014년 10월 26일
편집: Walter Roberson 2016년 1월 11일
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
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개)

카테고리

Help CenterFile Exchange에서 Wavelet Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by