1 Star 6 Fork 2

wycjl/kcf_matlab_apce

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gaussian_shaped_labels.m 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
wycjl 提交于 2020-05-14 11:37 . 第一次提交
function labels = gaussian_shaped_labels(sigma, sz)
%GAUSSIAN_SHAPED_LABELS
% Gaussian-shaped labels for all shifts of a sample.
%
% LABELS = GAUSSIAN_SHAPED_LABELS(SIGMA, SZ)
% Creates an array of labels (regression targets) for all shifts of a
% sample of dimensions SZ. The output will have size SZ, representing
% one label for each possible shift. The labels will be Gaussian-shaped,
% with the peak at 0-shift (top-left element of the array), decaying
% as the distance increases, and wrapping around at the borders.
% The Gaussian function has spatial bandwidth SIGMA.
%
% Joao F. Henriques, 2014
% http://www.isr.uc.pt/~henriques/
% %as a simple example, the limit sigma = 0 would be a Dirac delta,
% %instead of a Gaussian:
% labels = zeros(sz(1:2)); %labels for all shifted samples
% labels(1,1) = magnitude; %label for 0-shift (original sample)
%evaluate a Gaussian with the peak at the center element
[rs, cs] = ndgrid((1:sz(1)) - floor(sz(1)/2), (1:sz(2)) - floor(sz(2)/2));
labels = exp(-0.5 / sigma^2 * (rs.^2 + cs.^2));
%move the peak to the top-left, with wrap-around
labels = circshift(labels, -floor(sz(1:2) / 2) + 1);
%sanity check: make sure it's really at top-left
assert(labels(1,1) == 1)
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Matlab
1
https://gitee.com/19910509/kcf_matlab_apce.git
git@gitee.com:19910509/kcf_matlab_apce.git
19910509
kcf_matlab_apce
kcf_matlab_apce
master

搜索帮助