1 Star 0 Fork 2

范凯强/kcf_matlab_apce

forked from wycjl/kcf_matlab_apce 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gaussian_correlation.m 913 Bytes
一键复制 编辑 原始数据 按行查看 历史
wycjl 提交于 2020-05-14 11:37 . 第一次提交
function kf = gaussian_correlation(xf, yf, sigma)
%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.
%
% Joao F. Henriques, 2014
% http://www.isr.uc.pt/~henriques/
N = size(xf,1) * size(xf,2);
xx = xf(:)' * xf(:) / N; %squared norm of x
yy = yf(:)' * yf(:) / N; %squared norm of y
%cross-correlation term in Fourier domain
xyf = xf .* conj(yf);
xy = sum(real(ifft2(xyf)), 3); %to spatial domain
%calculate gaussian response for all positions, then go back to the
%Fourier domain
kf = fft2(exp(-1 / sigma^2 * max(0, (xx + yy - 2 * xy) / numel(xf))));
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Matlab
1
https://gitee.com/fkq15937592326/kcf_matlab_apce.git
git@gitee.com:fkq15937592326/kcf_matlab_apce.git
fkq15937592326
kcf_matlab_apce
kcf_matlab_apce
master

搜索帮助