Code covered by the BSD License  

Highlights from
Binary Image Watermarking/Data Hiding: Data, Algorithms, and Distortion Measure

Binary Image Watermarking/Data Hiding: Data, Algorithms, and Distortion Measure

by

 

26 Apr 2012 (Updated )

A package on binary image watermarking/data hiding, including data, algorithms & distortion measure.

corrcrop=cropone(Im0_2,ImWmed,linescrop)
function corrcrop=cropone(Im0_2,ImWmed,linescrop)

Im_wm=Im0_2;

%Im_wm(1:linescrop,:)=ImWmed(1:linescrop,:);
Im_wm((512-linescrop+1):512,:)=ImWmed((512-linescrop+1):512,:);

[Rows,Cols]=size(Im0_2);
RowsNum=64;%512/8
ColsNum=64;

h = fspecial('gaussian',5,1);
FImg=filter2(h,Im0_2);
length=mark_length(Im0_2,8,RowsNum,ColsNum,1);
wm_extracted=zeros(1,length);

k=1;
blkrows = 1:8;
blkcols = blkrows;
for i=0:(RowsNum-1)
   for j=0:(ColsNum-1)
      blk0_2=Im0_2(i*8+blkrows, j*8+blkcols);
      if max(max(blk0_2))~=min(min(blk0_2))
          blk0=FImg(i*8+blkrows, j*8+blkcols);
          blkdct0= dct2(blk0);

          blk_wm=Im_wm(i*8+blkrows, j*8+blkcols);
          blkdct_wm= dct2(blk_wm);
          wm_extracted(k)=blkdct_wm(1,1)-blkdct0(1,1);  %fail if blkdct_wm(1,1)/blkdct0(1,1);
          k=k+1;
    end
  end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load wm
corrcrop=corr2(wm,wm_extracted);

Contact us