coxdetect.m

来自「这是一个关于信息隐藏的源代码,是用vc++开发」· M 代码 · 共 61 行

M
61
字号
%CoxDetect.m
function sim = CoxDetect(I, J, W, alpha, N)
%COXDETECT Detect wheter a watermark is present in J.
%   sim = COXDETECT(I, J, W, alpha, N) simply extracts the
%   watermark from J and check whether it is similar to the
%   original one (W). I is the original image.
%   alpha and N are optional parameters used during the
%   embedding of the watermark (see COXWMK)
%
%   See: COXWMK, COXTEST, COXEXTRACT, SIM

%   This is a modified version of Fabien Petitcolas' implementation
%   of Cox's technique by Gabriela Delfino and Fabian Martinez
%
%   Fabien Petitcolas' website: http://www.cl.cam.ac.uk/~fapp2

if (nargin == 3)
   N = 1000;
%  alpha = 0.1;
   alpha = 0.01;
end
if (nargin == 4)
   N = 1000;
end

if (~isrgb(I))
   % First extract the watermark from suspect image
   X = CoxExtract(I, J, alpha, N);
   
   % Compare with original watermark
   sim = Similar(W, X);
else
   
%   % Simple implementation: apply the same algorithm
%   % to each color
%   
%   for l = 1:3
%     % First extract the watermark from suspect image
%     X = CoxExtract(I(:, :, l), J(:, :, l), alpha, N);
%     % Compare with original watermark  
%	sim(l) = similar(W, X);
%   end

   % The process extraction and sim of the watermark was completely 
   % changed.
   % The watermark if present will be found in the Y plane of the 
   % image.
   originalYIQ=RGBtoYIQ(I);
   originalY=originalYIQ(:,:,1);

   marcadaYIQ=RGBtoYIQ(J);
   marcadaY=marcadaYIQ(:,:,1);
   
   % We first extract the watermark from J
   X = CoxExtract(originalY, marcadaY, alpha, N);
   
   % We compare the original with the extracted watermark
   sim = similar(W, X);

end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?