|
|
LSB and DWT watermarking
Posted:
Nov 25, 2010 12:36 AM
|
|
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');
|
|