Hiding data from a text file in a image file using dwt steganography

1.1k views Asked by At

The code below hides the text "helloworld" in the two specified DWT coefficients using steganography. I have been trying to adapt the code to hide data contained in a .txt file. I have been working on this for a while but cant seem to get anything to work correctly. Can anyone help please?

clear all;
close all;

dataToHide = 'helloworld';

wavename = 'haar';

data = zeros(1,length (dataToHide));
for i =1 : length(dataToHide);
    d = dataToHide (i)+0;
    data (i) = d;
end

im=imread ('cameraman.tif');
%imshow(im);

[cA1, cH1,cV1, cD1]= dwt2(im,wavename);
A1 = upcoef2('a',cA1,wavename,1);
H1 = upcoef2('h',cH1,wavename,1);
V1 = upcoef2('v',cV1,wavename,1);
D1 = upcoef2('d',cD1,wavename,1);

subplot(2,2,1); image(wcodemat(A1,192));
title ('A1');

subplot(2,2,2); image(wcodemat(H1,192));
title ('H1');
 M=max(data);
 normilize = data/M;
 n=length(data);

 cH1 (1,1) = -1*(n/10);
 cH1 (1,2) = -1*(M/10);

 [~ , y] =size(cH1);

 for i = 1 : ceil(n/2)
     cV1 (i,y) = normilize(i);
 end

 for i= ceil(n/2)+1 :n;
    cD1 (i,y) = normilize(i);
 end

Update


I can know read text from the file.However, I have come across another problem. When I read from file I want to convert the text to binary (name=dec2bin(dataToHide). The above code doesn't want to hide binary data for me?? I am very new to matlab & steganography/watermarking. I have been doing lots of research regarding LSB embedding in the discrete wavelet transform. However, the code above, which I took from the web is manipulating subband coefficients, but from what I can read from the code it is not doing it by LSB replacement. (i.e replace LSB of cover image with MSB of the secret data file). Can anyone recommend some code for me to look at that works by LSb wavelets embedding?

0

There are 0 answers