際際滷

際際滷Share a Scribd company logo
Wavelet watermark level2
Watermark algorithm
?   function [D]=blockdwt2c(A,W);
?
?   [row,col]=size(A);
?
?   Tr=250;
?   k=0.01;
?
?   [ca,ch,cv,cd] = dwt2(A,'Haar');
?   c1 = [ch cv cd];
?
?   %%%%%%Wavelet level 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
?
?   [ca1, ch1, cv1, cd1]= dwt2(ca,'Haar');
?
?   c2=[ch1 cv1 cd1];
?
?   [h, w] = size(ca1');
?   [m, n] = size(c2');
?
?   W=dmgb(W,A);
?
?   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Here we take the wavelet transform of the
?   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%watermark
Watermark algorithm
?
?
              continued
    [caa chh cvv cdd]=dwt2(W,'Haar');
?   W=caa;
?   size(W);
?
?   % Adding watermark image.
?
?   for i=1:h
?     for j=1:w
?        if ca1(i,j)>Tr
?           Ca(i,j)=ca1(i,j)+k*W(i,j); % <--------k*abs(double(c1(i,j)))*W(i,j); de olabilir
?        else
?           Ca(i,j)=ca1(i,j);
?        end
?     end
?   end
?
?   % CH1=C1(1:h,1:w);
?   % CV1=C1(1:h,w+1:2*w);
?   % CD1=C1(1:h,2*w+1:3*w);
?
?   D0= double( idwt2(Ca,ch1, cv1, cd1,'Haar') );
?
?   D= double(idwt2(D0, ch, cv, cd, 'Haar'));
Reversing and detecting
    the watermark
            ? h = fspecial('gaussian');
                    ? >> I2 = imfilter(marked,h);
                    ? imshow(uint8(marked)),
                      title('Original Image')
                    ? figure, imshow(uint8(I2)),
                      title('Filtered Image')
                    ? >> a=I2-image1;
                    ? >> [ca ch cv
                      cd]=dwt2(a,'haar');
                    ? >> [ca1 ch1 cv1 cd1]=
                      dwt2(ca,'haar');
                    ? >> imshow(ca1)
Wavelet watermark level2

More Related Content

Wavelet watermark level2

  • 2. Watermark algorithm ? function [D]=blockdwt2c(A,W); ? ? [row,col]=size(A); ? ? Tr=250; ? k=0.01; ? ? [ca,ch,cv,cd] = dwt2(A,'Haar'); ? c1 = [ch cv cd]; ? ? %%%%%%Wavelet level 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ? ? [ca1, ch1, cv1, cd1]= dwt2(ca,'Haar'); ? ? c2=[ch1 cv1 cd1]; ? ? [h, w] = size(ca1'); ? [m, n] = size(c2'); ? ? W=dmgb(W,A); ? ? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Here we take the wavelet transform of the ? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%watermark
  • 3. Watermark algorithm ? ? continued [caa chh cvv cdd]=dwt2(W,'Haar'); ? W=caa; ? size(W); ? ? % Adding watermark image. ? ? for i=1:h ? for j=1:w ? if ca1(i,j)>Tr ? Ca(i,j)=ca1(i,j)+k*W(i,j); % <--------k*abs(double(c1(i,j)))*W(i,j); de olabilir ? else ? Ca(i,j)=ca1(i,j); ? end ? end ? end ? ? % CH1=C1(1:h,1:w); ? % CV1=C1(1:h,w+1:2*w); ? % CD1=C1(1:h,2*w+1:3*w); ? ? D0= double( idwt2(Ca,ch1, cv1, cd1,'Haar') ); ? ? D= double(idwt2(D0, ch, cv, cd, 'Haar'));
  • 4. Reversing and detecting the watermark ? h = fspecial('gaussian'); ? >> I2 = imfilter(marked,h); ? imshow(uint8(marked)), title('Original Image') ? figure, imshow(uint8(I2)), title('Filtered Image') ? >> a=I2-image1; ? >> [ca ch cv cd]=dwt2(a,'haar'); ? >> [ca1 ch1 cv1 cd1]= dwt2(ca,'haar'); ? >> imshow(ca1)