0

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?

  • So all you need is for `dataToHide` to load some text from a file? `fileread` should do the trick. – Reti43 Nov 13 '14 at 18:56
  • Yes, Thank you. I have now another problem (updated above) Would really appreciate any advice?? – Hitmanpaddy Nov 20 '14 at 16:48
  • You shouldn't change a question because any answers so far will become irrelevant. Instead, create a new question. I would also advise you to read the [Help Section](http://stackoverflow.com/help) about what questions you can ask and how. For example, questions asking us to recommend a libary or tool are considered [off-topic](http://stackoverflow.com/help/on-topic). For another, your current question is "how to load text from a text file" in disguise, for which there are many answers around here. – Reti43 Nov 20 '14 at 21:53

0 Answers0