GETSCALEFACTORSTRUCT.m select the target's scale GETSCALEFACTORSTRUCT this functions allows to select the new scales for the DS-KCF tracker's model, according to the actual depth distribution of the target. For more information about scale selection please see [1] INPUT: -estimatedDepthMode depth of the target -scaleDSKCF_struct scale data structure (see INITDSKCFPARAM) OUTPUT -scaleDSKCF_struct updated scale data structure See also INITDSKCFPARAM University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 function scaleDSKCF_struct=getScaleFactorStruct(estimatedDepthMode,scaleDSKCF_struct) 0002 % GETSCALEFACTORSTRUCT.m select the target's scale 0003 % 0004 % GETSCALEFACTORSTRUCT this functions allows to select the new scales for 0005 % the DS-KCF tracker's model, according to the actual depth distribution 0006 % of the target. For more information about scale selection please see 0007 % [1] 0008 % 0009 % INPUT: 0010 % -estimatedDepthMode depth of the target 0011 % -scaleDSKCF_struct scale data structure (see INITDSKCFPARAM) 0012 % 0013 % OUTPUT 0014 % -scaleDSKCF_struct updated scale data structure 0015 % 0016 % 0017 % See also INITDSKCFPARAM 0018 % 0019 % University of Bristol 0020 % Massimo Camplani and Sion Hannuna 0021 % 0022 % massimo.camplani@bristol.ac.uk 0023 % hannuna@compsci.bristol.ac.uk 0024 0025 scaleDSKCF_struct.updated = 0; 0026 0027 mode1 = estimatedDepthMode; 0028 scaleDSKCF_struct.currDepth = mode1; 0029 0030 sf = scaleDSKCF_struct.InitialDepth / mode1; 0031 0032 % Check for significant scale difference to current scale 0033 scaleOffset = sf - scaleDSKCF_struct.scales(scaleDSKCF_struct.i); 0034 if abs(scaleOffset) > scaleDSKCF_struct.minStep %% Need to change scale if possible 0035 if scaleOffset < 0 && scaleDSKCF_struct.i > 1% Getting smaller + check not smallest already 0036 diffs = scaleDSKCF_struct.scales(1:scaleDSKCF_struct.i) - sf; 0037 [a ind] = min(abs(diffs)); 0038 if ind ~= scaleDSKCF_struct.i 0039 scaleDSKCF_struct.iPrev = scaleDSKCF_struct.i; 0040 scaleDSKCF_struct.i = ind; 0041 scaleDSKCF_struct.updated = 1; 0042 end 0043 elseif scaleOffset > 0 && scaleDSKCF_struct.i < length(scaleDSKCF_struct.scales) % Getting bigger+ check not at biggest already 0044 diffs = scaleDSKCF_struct.scales(scaleDSKCF_struct.i:end) - sf; 0045 [a ind] = min(abs(diffs)); 0046 ind = ind + scaleDSKCF_struct.i - 1; 0047 if ind ~= scaleDSKCF_struct.i 0048 scaleDSKCF_struct.iPrev = scaleDSKCF_struct.i; 0049 scaleDSKCF_struct.i = ind; 0050 scaleDSKCF_struct.updated = 1; 0051 end 0052 end 0053 end 0054 0055