Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: LSB and DWT watermarking
Replies: 4   Last Post: Jul 14, 2012 8:05 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
lydia rasman

Posts: 2
Registered: 11/25/10
LSB and DWT watermarking
Posted: Nov 25, 2010 12:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi, i'm on a project based on dwt watermarking. To embed the watermark, i need to use LSB. I'm not sure what i understand is correct or not, but i try to embed the watermark in LL frequency. but having problem with the bitset. it give me error 'inputs must be non-negative integer'. really hope that anyone can help me.i'm totally new to both dwt, lsb, watermarking and matlab..thx..here is some code that try to modified according to my need:

% loading cover image
X=imread('image.jpg');
P=im2double(X);
imshow(P);

% decompose using db level 1
[F1,F2]= wfilters('haar', 'd');
[LL,LH,HL,HH] = dwt2(P,'haar','d');
figure, title('DWT');
subplot(2,2,1);
imshow(LL,'DisplayRange',[]), title('Low Low');
subplot(2,2,2);
imshow(LH,'DisplayRange',[]),title('Low High');
subplot(2,2,3);
imshow(HL,'DisplayRange',[]),title('High Low ');
subplot(2,2,4);
imshow(HH,'DisplayRange',[]),title('High High');


%the data
data = 'Lydia';
numdata = double (data);
bindata= de2bi (numdata);
disp(bindata);

% determine size of cover object
Mc=size(LL,1); %Height
Nc=size(LL,2); %Width
disp(Mc);
disp(Nc);

% determine size of message object
Mm=size(bindata,1); %Height
Nm=size(bindata,2); %Width
disp(Mm);
disp(Nm);

% title the message object out to cover object size to generate watermark
for ii = 1:Mc
for jj = 1:Nc
watermark(ii,jj)=bindata(mod(ii,Mm)+1,mod(jj,Nm)+1);
end
end


% now we set the lsb of cover_object(ii,jj) to the value of watermark(ii,jj)
for ii = 1:Mc
for jj = 1:Nc
LL_1(ii,jj)=bitset(LL_1(ii,jj),1,watermark(ii,jj));
end
end

watermarked_image = idwt2(LL_1,LH,HL,HH,'haar','d');
imwrite(watermarked_image,'watermarked.jpg');
figure, imshow(watermarked_image,'DisplayRange',[]),title('Watermarked image');



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.