INITDSKCFPARAM.m initializes the scale data structure for DS-KCF tracker [1] INITDSKCFPARAM function initializes the scale data structure of the DS-KCF tracker. In particular, some matrices are precomputed at the different scales and other flags are intialized INPUT: -DSKCFparameters DS-KCF algorithm parameters -target_sz initial target size of the tracked object -pos initial target position of the tracked object OUTPUT -scaleDSKCF_struct data structure that contains scales parameters and precomputed matrices. In particular the field of the struct are + i current scale among Sq in [1] + iPrev previous scale among Sq in [1] + minStep minimum interval between the scales in Sq in [1] + scales is the Sq vector in [1] + step minimum interval between the scales in Sq (the same as minStep) + updated flag set to 1 (or 0) when a change of scale is (or not) required + currDepth is the ratio between the initial depth target and the current one. Is Sr in [1] + InitialDepth initial ratio + InitialTargetSize size of the target in the initial frame + windows_sizes vector containing precomputed windows size (according the padding parameter) for each scale + target_sz vector containing the expected target size at the different scales + pos vector where is stored per each scale the target centroid position + output_sigmas vector where sigma parameter is stored for each scale + yfs regression targets for all the scales + cos_windows precomputed cosine windows for each scale + len contains the area of the target at each scale + ind [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T. Burghardt, A.Paiement, L. Tao, DS-KCF: A real-time tracker for RGB-D data, Journal of Real-Time Image Processing University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 function scaleDSKCF_struct=initDSKCFparam(DSKCFparameters,target_sz,pos) 0002 % INITDSKCFPARAM.m initializes the scale data structure for DS-KCF tracker [1] 0003 % 0004 % INITDSKCFPARAM function initializes the scale data structure of the 0005 % DS-KCF tracker. In particular, some matrices are precomputed at the 0006 % different scales and other flags are intialized 0007 % 0008 % INPUT: 0009 % -DSKCFparameters DS-KCF algorithm parameters 0010 % -target_sz initial target size of the tracked object 0011 % -pos initial target position of the tracked object 0012 % OUTPUT 0013 % -scaleDSKCF_struct data structure that contains scales parameters and 0014 % precomputed matrices. In particular the field of the struct are 0015 % 0016 % + i current scale among Sq in [1] 0017 % + iPrev previous scale among Sq in [1] 0018 % + minStep minimum interval between the scales in Sq in [1] 0019 % + scales is the Sq vector in [1] 0020 % + step minimum interval between the scales in Sq (the same as minStep) 0021 % + updated flag set to 1 (or 0) when a change of scale is (or not) 0022 % required 0023 % + currDepth is the ratio between the initial depth target and the 0024 % current one. Is Sr in [1] 0025 % + InitialDepth initial ratio 0026 % + InitialTargetSize size of the target in the initial frame 0027 % + windows_sizes vector containing precomputed windows size (according 0028 % the padding parameter) for each scale 0029 % + target_sz vector containing the expected target size at the different 0030 % scales 0031 % + pos vector where is stored per each scale the target centroid position 0032 % + output_sigmas vector where sigma parameter is stored for each scale 0033 % + yfs regression targets for all the scales 0034 % + cos_windows precomputed cosine windows for each scale 0035 % + len contains the area of the target at each scale 0036 % + ind 0037 % 0038 % [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T. 0039 % Burghardt, A.Paiement, L. Tao, DS-KCF: A real-time tracker for RGB-D 0040 % data, Journal of Real-Time Image Processing 0041 % 0042 % 0043 % University of Bristol 0044 % Massimo Camplani and Sion Hannuna 0045 % 0046 % massimo.camplani@bristol.ac.uk 0047 % hannuna@compsci.bristol.ac.uk 0048 0049 scaleDSKCF_struct=[]; 0050 0051 % Find initial scale 0052 scaleDSKCF_struct.i = find(DSKCFparameters.scales == 1); 0053 scaleDSKCF_struct.iPrev = scaleDSKCF_struct.i; % for inerpolating model 0054 scaleDSKCF_struct.minStep = min(abs(diff(DSKCFparameters.scales))); 0055 scaleDSKCF_struct.scales = DSKCFparameters.scales; 0056 scaleDSKCF_struct.step = min(diff(DSKCFparameters.scales)); % use smallest step to decide whether to look at other scales 0057 scaleDSKCF_struct.updated = 0; 0058 scaleDSKCF_struct.currDepth = 1; 0059 scaleDSKCF_struct.InitialDepth = 1; 0060 scaleDSKCF_struct.InitialTargetSize = target_sz; 0061 0062 for i=1:length(DSKCFparameters.scales) 0063 scaleDSKCF_struct.windows_sizes(i).window_sz = round(DSKCFparameters.window_sz * DSKCFparameters.scales(i)); 0064 scaleDSKCF_struct.target_sz(i).target_sz = round(target_sz * DSKCFparameters.scales(i)); 0065 scaleDSKCF_struct.pos(i).pos = pos; 0066 0067 %create regression labels, gaussian shaped, with a bandwidth 0068 %proportional to target size 0069 scaleDSKCF_struct.output_sigmas(i).output_sigma = sqrt(prod(scaleDSKCF_struct.target_sz(i).target_sz)) * DSKCFparameters.output_sigma_factor / DSKCFparameters.cell_size; 0070 scaleDSKCF_struct.yfs(i).yf = fft2(gaussian_shaped_labels( scaleDSKCF_struct.output_sigmas(i).output_sigma, floor( scaleDSKCF_struct.windows_sizes(i).window_sz / DSKCFparameters.cell_size))); 0071 0072 %store pre-computed cosine window 0073 scaleDSKCF_struct.cos_windows(i).cos_window = hann(size(scaleDSKCF_struct.yfs(i).yf,1)) * hann(size(scaleDSKCF_struct.yfs(i).yf,2))'; 0074 scaleDSKCF_struct.lens(i).len = scaleDSKCF_struct.target_sz(i).target_sz(1) * scaleDSKCF_struct.target_sz(i).target_sz(2); 0075 scaleDSKCF_struct.inds(i).ind = floor(linspace(1,scaleDSKCF_struct.lens(i).len, round(0.25 * scaleDSKCF_struct.lens(i).len))); 0076 end 0077 0078 scaleDSKCF_struct.prevpos=pos;