zoukankan      html  css  js  c++  java
  • High-Speed Tracking with Kernelized Correlation Filters(二)

                  首先看看get_features函数。

                首先判断是hog特征还是gray,分两种情况。

                如果是hog特征,调用fhog函数,返回x,并将矩阵x的第三维最后一个组数据删除(好奇fhog函数http://vision.ucsd.edu/~pdollar/toolbox/doc/index.html)。

                

    1 if features.hog,
    2         %HOG features, from Piotr's Toolbox
    3         x = double(fhog(single(im) / 255, cell_size, features.hog_orientations));
    4         x(:,:,end) = [];  %remove all-zeros channel ("truncation feature")
    5                           %将矩阵x的第三维最后一个组数据删除
    6     end

                如果是gray,则直接对其归一化处理。

                 

    if features.gray,
            %gray-level (scalar feature)
            x = double(im) / 255;
            
            x = x - mean(x(:));
        end

               函数最后返回x            

     

            下面分析下各个核的correlation。

            首先是gaussian核,计算跟CSK没什么两样:

            

     1 N = size(xf,1) * size(xf,2);
     2     xx = xf(:)' * xf(:) / N;  %squared norm of x
     3     yy = yf(:)' * yf(:) / N;  %squared norm of y
     4     
     5     %cross-correlation term in Fourier domain
     6     xyf = xf .* conj(yf);
     7     xy = sum(real(ifft2(xyf)), 3);  %to spatial domain
     8     
     9     %calculate gaussian response for all positions, then go back to the
    10     %Fourier domain
    11     kf = fft2(exp(-1 / sigma^2 * max(0, (xx + yy - 2 * xy) / numel(xf))));

            

       对于linear kernel

    kf = sum(xf .* conj(yf), 3) / numel(xf);

     

        对于polynomial kernel

     

    1      xyf = xf .* conj(yf);
    2     xy = sum(real(ifft2(xyf)), 3);  %to spatial domain
    3     
    4     %calculate polynomial response for all positions, then go back to the
    5     %Fourier domain
    6     kf = fft2((xy / numel(xf) + a) .^ b);

            

  • 相关阅读:
    Devpexpress 打印预览问题
    常用DOS命令
    C# datetimePicker控件格式设置
    DevExpress中GridControl的属性设置
    C++ 学习1
    layui 时间控件选择一闪就消失,打不开问题解决办法
    echarts报错,Uncaught Error: series.type should be specified?
    vue项目中,在mian.js文件中引入scss文件后,报错
    记一次在vue中使用scss报错
    使用hexo搭建个人博客时引入图片失败
  • 原文地址:https://www.cnblogs.com/573177885qq/p/4820872.html
Copyright © 2011-2022 走看看