gaussian_correlation

PURPOSE ^

GAUSSIAN_CORRELATION Gaussian Kernel at all shifts, i.e. kernel correlation.

SYNOPSIS ^

function kf = gaussian_correlation(xf, yf, sigma)

DESCRIPTION ^

GAUSSIAN_CORRELATION Gaussian Kernel at all shifts, i.e. kernel correlation.
   Evaluates a Gaussian kernel with bandwidth SIGMA for all relative
   shifts between input images X and Y, which must both be MxN. They must 
   also be periodic (ie., pre-processed with a cosine window). The result
   is an MxN map of responses.

   Inputs and output are all in the Fourier domain.

   See also MAXRESPONSEDSKCF, MAXRESPONSEDEPTHWEIGHTDSKCF,
   MODELUPDATEDSKCF, LINEAR_CORRELATION, POLYNOMIAL_CORRELATION,


   This function has been inserted in the DS-KCF matlab library from the
   KCF library released by

   Joao F. Henriques, 2014
   http://www.isr.uc.pt/~henriques/

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function kf = gaussian_correlation(xf, yf, sigma)
0002 %GAUSSIAN_CORRELATION Gaussian Kernel at all shifts, i.e. kernel correlation.
0003 %   Evaluates a Gaussian kernel with bandwidth SIGMA for all relative
0004 %   shifts between input images X and Y, which must both be MxN. They must
0005 %   also be periodic (ie., pre-processed with a cosine window). The result
0006 %   is an MxN map of responses.
0007 %
0008 %   Inputs and output are all in the Fourier domain.
0009 %
0010 %   See also MAXRESPONSEDSKCF, MAXRESPONSEDEPTHWEIGHTDSKCF,
0011 %   MODELUPDATEDSKCF, LINEAR_CORRELATION, POLYNOMIAL_CORRELATION,
0012 %
0013 %
0014 %   This function has been inserted in the DS-KCF matlab library from the
0015 %   KCF library released by
0016 %
0017 %   Joao F. Henriques, 2014
0018 %   http://www.isr.uc.pt/~henriques/
0019     
0020     N = size(xf,1) * size(xf,2);
0021     xx = xf(:)' * xf(:) / N;  %squared norm of x
0022     yy = yf(:)' * yf(:) / N;  %squared norm of y
0023     
0024    
0025     %cross-correlation term in Fourier domain
0026     xyf = xf .* conj(yf);
0027     xy = sum(real(ifft2(xyf)), 3);  %to spatial domain
0028     
0029     %calculate gaussian response for all positions, then go back to the
0030     %Fourier domain
0031     kf = fft2(exp(-1 / sigma^2 * max(0, (xx + yy - 2 * xy) / numel(xf))));
0032     %whos
0033     %pause
0034     %xf
0035     %yf
0036     %pause
0037 end
0038

Generated on Thu 24-Nov-2016 18:03:21 by m2html © 2005