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.

[corrnoise,change]=noiseone(Im0_2,ImWmed,variance);
function [corrnoise,change]=noiseone(Im0_2,ImWmed,variance);

Im_wm=imnoise(ImWmed,'gaussian',0,variance);

Im_wm=im2bw(Im_wm);

[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
corrnoise=corr2(wm,wm_extracted);
diffimg=xor(Im_wm,Im0_2);
change=sum(sum(diffimg))/(Rows*Cols);

Contact us