MAXRESPONSEDEPTHWEIGHTDSKCF function for calculating the DSKCF response % MAXRESPONSEDEPTHWEIGHTDSKCF.m is a function used for calculating the DSKCF response by weighting it with the depth values and the target depth distribution For more information about the DSKCF response see [1]. Please note that this function was partially built extending the KCF tracker code presented by Joao F. Henriques, in http://www.isr.uc.pt/~henriques/. INPUT: -patch patch of the color data -patch_depth patch of the depth data - depth16Bit depth image -features struct containing feature info. -cell_size HOG parameter -cos_window cosine window to smooth data in the Fourier domain -kernel struct containing kernel information - model_alphaf, model_alphaDf, model_xf, model_xDf are the models to be updated (for depth and color if the two features are used indipendently) -meanDepthObj mean depth value of the target object -pos is the position of the tracked target in the previous frame [y x] format (read as ([row column])) OUTPUT - response response of DSKCF -maxResponse maximum value of the DSKCF response -maxPositionImagePlane vector containing the position in the image plane of the target's centroid. It is in the format [y, x] (read also as [rowIndex, columIndex]) See also GAUSSIAN_CORRELATION, GET_FEATURES_DEPTH, BESTRESPONSES, POLYNOMIAL_CORRELATION, LINEAR_CORRELATION, SINGLEFRAMEDSKCF [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 [2] J. F. Henriques, R. Caseiro, P. Martins, and J. Batista. High-speed tracking with kernelized correlation filters. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 2015. University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 0002 function [ response, maxResponse, maxPositionImagePlane] = maxResponseDepthWeightDSKCF... 0003 ( patch,patch_depth,depth16Bit, features,kernel,pos,cell_size, cos_window,... 0004 model_xf,model_alphaf,model_xDf,model_alphaDf,meanDepthObj,stdDepthObj) 0005 %MAXRESPONSEDEPTHWEIGHTDSKCF function for calculating the DSKCF response % 0006 % 0007 %MAXRESPONSEDEPTHWEIGHTDSKCF.m is a function used for calculating the DSKCF response 0008 %by weighting it with the depth values and the target depth distribution 0009 %For more information about the DSKCF response see [1]. Please note that 0010 %this function was partially built extending the KCF tracker code presented 0011 %by Joao F. Henriques, in http://www.isr.uc.pt/~henriques/. 0012 % 0013 % 0014 % INPUT: 0015 % -patch patch of the color data 0016 % -patch_depth patch of the depth data 0017 % - depth16Bit depth image 0018 % -features struct containing feature info. 0019 % -cell_size HOG parameter 0020 % -cos_window cosine window to smooth data in the Fourier domain 0021 % -kernel struct containing kernel information 0022 % - model_alphaf, model_alphaDf, model_xf, model_xDf are the models to be 0023 % updated (for depth and color if the two features are used indipendently) 0024 % -meanDepthObj mean depth value of the target object 0025 % -pos is the position of the tracked target in the previous frame [y 0026 % x] format (read as ([row column])) 0027 % 0028 % OUTPUT 0029 % - response response of DSKCF 0030 % -maxResponse maximum value of the DSKCF response 0031 % -maxPositionImagePlane vector containing the position in the image 0032 % plane of the target's centroid. It is in the format [y, x] (read also as 0033 % [rowIndex, columIndex]) 0034 % 0035 % See also GAUSSIAN_CORRELATION, GET_FEATURES_DEPTH, BESTRESPONSES, 0036 % POLYNOMIAL_CORRELATION, LINEAR_CORRELATION, SINGLEFRAMEDSKCF 0037 % 0038 % 0039 % [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T. Burghardt, 0040 % A.Paiement, L. Tao, DS-KCF: A ~real-time tracker for RGB-D data, Journal 0041 % of Real-Time Image Processing 0042 % 0043 % [2] J. F. Henriques, R. Caseiro, P. Martins, and J. Batista. High-speed 0044 % tracking with kernelized correlation filters. Pattern Analysis and 0045 % Machine Intelligence, IEEE Transactions on, 2015. 0046 % 0047 % University of Bristol 0048 % Massimo Camplani and Sion Hannuna 0049 % 0050 % massimo.camplani@bristol.ac.uk 0051 % hannuna@compsci.bristol.ac.uk 0052 0053 if(features.hog_linear) 0054 0055 [zf zDf]=get_features_depth(patch,patch_depth, features, cell_size, cos_window); 0056 zf=fft2(zf); 0057 zDf=fft2(zDf); 0058 %calculate response of the classifier at all shifts 0059 switch kernel.type 0060 case 'gaussian', 0061 kzf = gaussian_correlation(zf, model_xf, kernel.sigma); 0062 kzDf = gaussian_correlation(zDf, model_xDf, kernel.sigma); 0063 0064 case 'polynomial', 0065 kzf = polynomial_correlation(zf, model_xf, kernel.poly_a, kernel.poly_b); 0066 kzDf = polynomial_correlation(zDf, model_xDf, kernel.poly_a, kernel.poly_b); 0067 case 'linear', 0068 kzf = linear_correlation(zf, model_xf); 0069 kzDf = linear_correlation(zDf, model_xDf); 0070 end 0071 response = real(ifft2(model_alphaf .* kzf)); %equation for fast detection 0072 responseD = real(ifft2(model_alphaDf .* kzDf)); 0073 0074 %COMBINATION OF RESPONSES LINEAR... 0075 response=response+responseD; 0076 response=response./2; 0077 0078 %Combination of Response....select maximmun 0079 %maxResponseRGB=max(response(:)); 0080 %[maxResponseD,index]=max(responseD(:)); 0081 %if(maxResponseD>maxResponseRGB) 0082 % response(index)=maxResponseD; 0083 %end 0084 else 0085 0086 [zf dummyValue]=get_features_depth(patch,patch_depth, features, cell_size, cos_window); 0087 zf=fft2(zf); 0088 0089 %calculate response of the classifier at all shifts 0090 switch kernel.type 0091 case 'gaussian', 0092 kzf = gaussian_correlation(zf, model_xf, kernel.sigma); 0093 case 'polynomial', 0094 kzf = polynomial_correlation(zf, model_xf, kernel.poly_a, kernel.poly_b); 0095 case 'linear', 0096 kzf = linear_correlation(zf, model_xf); 0097 end 0098 response = real(ifft2(model_alphaf .* kzf)); %equation for fast detection 0099 0100 end 0101 0102 %now select the maximum adding a depth weight 0103 %the number of candidate is set to 10 0104 [maxResponse,maxPositionImagePlane]=bestResponses(depth16Bit,response,10,... 0105 cell_size,pos,meanDepthObj,stdDepthObj);