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] M. Camplani, S. Hannuna, D. Damen, M. Mirmehdi, A. Paiment, L. Tao, T. burghard. Robust Real-time RGB-D Tracking with Depth Scaling Kernelised Correlation Filters and Occlusion Handling, BMVC 2015 University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 function scaleDSKCF_struct=initDSKCFparam_squareShape(DSKCFparameters,target_sz,target_szSquared,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] M. Camplani, S. Hannuna, D. Damen, M. Mirmehdi, A. Paiment, L. Tao, 0039 % T. burghard. Robust Real-time RGB-D Tracking with Depth Scaling 0040 % Kernelised Correlation Filters and Occlusion Handling, BMVC 2015 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 scaleDSKCF_struct.InitialTargetSizeSquared = target_szSquared; 0062 0063 0064 for i=1:length(DSKCFparameters.scales) 0065 scaleDSKCF_struct.windows_sizes(i).window_sz = round(DSKCFparameters.window_sz * DSKCFparameters.scales(i)); 0066 scaleDSKCF_struct.target_sz(i).target_sz = round(target_sz * DSKCFparameters.scales(i)); 0067 scaleDSKCF_struct.target_szSquared(i).target_szSquared = round(target_szSquared * DSKCFparameters.scales(i)); 0068 scaleDSKCF_struct.pos(i).pos = pos; 0069 0070 %create regression labels, gaussian shaped, with a bandwidth 0071 %proportional to target size 0072 %KEEEEEP THE SAME SIGMA.... 0073 %scaleDSKCF_struct.output_sigmas(i).output_sigma = sqrt(prod(scaleDSKCF_struct.target_sz(i).target_sz)) * DSKCFparameters.output_sigma_factor / DSKCFparameters.cell_size; 0074 %DONT KEEP 0075 scaleDSKCF_struct.output_sigmas(i).output_sigma = sqrt(prod(scaleDSKCF_struct.target_szSquared(i).target_szSquared)) * DSKCFparameters.output_sigma_factor / DSKCFparameters.cell_size; 0076 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))); 0077 0078 %store pre-computed cosine window 0079 scaleDSKCF_struct.cos_windows(i).cos_window = hann(size(scaleDSKCF_struct.yfs(i).yf,1)) * hann(size(scaleDSKCF_struct.yfs(i).yf,2))'; 0080 scaleDSKCF_struct.lens(i).len = scaleDSKCF_struct.target_sz(i).target_sz(1) * scaleDSKCF_struct.target_sz(i).target_sz(2); 0081 scaleDSKCF_struct.inds(i).ind = floor(linspace(1,scaleDSKCF_struct.lens(i).len, round(0.25 * scaleDSKCF_struct.lens(i).len))); 0082 end 0083 0084 scaleDSKCF_struct.prevpos=pos;