SINGLEFRAMEDSKCF_OCCLUDER.m functions for tracking occluding object SINGLEFRAMEDSKCF_OCCLUDER is the function for tracking the occluding object in the DS-KCF tracker framework (for more details see [1]). This function is based on several data structures where input and output data is stored.Please note that data structures are supposed to be initialized as in wrapperDSKCF and runDSKCF.m test script. INPUT: - firstFrame boolean flag that marks the first frame of the sequence - im color data - depth depth data (8bit image) - trackerDSKCF_structOccluder DS-KCF tracker data structure (see WRAPPERDSKCF, INITDSKCFTRACKER) - DSKCFparameters, parameters structures OUTPUT -newPos updated position of the DS-KCF tracker while tracking the occluding object newPos=[y x] where x is the column and y is the row index -trackerDSKCF_structOccluder updated data structure for the trackers See also MAXRESPONSEDSKCF , SINGLEFRAMEDSKCF, GET_SUBWINDOW, MODELUPDATEDSKCF, FROMCENTRALPOINTTOBB [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 [trackerDSKCF_structOccluder,newPos]=singleFrameDSKCF_occluder(firstFrame,... 0002 im,depth,trackerDSKCF_structOccluder,DSKCFparameters) 0003 % SINGLEFRAMEDSKCF_OCCLUDER.m functions for tracking occluding object 0004 % 0005 % SINGLEFRAMEDSKCF_OCCLUDER is the function for tracking the occluding 0006 % object in the DS-KCF tracker framework (for more details see [1]). This 0007 % function is based on several data structures where input and output 0008 % data is stored.Please note that data structures are supposed to be 0009 % initialized as in wrapperDSKCF and runDSKCF.m test script. 0010 % 0011 % INPUT: 0012 % - firstFrame boolean flag that marks the first frame of the 0013 % sequence 0014 % - im color data 0015 % - depth depth data (8bit image) 0016 % - trackerDSKCF_structOccluder DS-KCF tracker data structure (see WRAPPERDSKCF, 0017 % INITDSKCFTRACKER) 0018 % - DSKCFparameters, parameters structures 0019 % 0020 % 0021 % OUTPUT 0022 % -newPos updated position of the DS-KCF tracker while tracking the 0023 % occluding object newPos=[y x] where x is the column and y is the row 0024 % index 0025 % -trackerDSKCF_structOccluder updated data structure for the trackers 0026 % 0027 % See also MAXRESPONSEDSKCF , SINGLEFRAMEDSKCF, GET_SUBWINDOW, 0028 % MODELUPDATEDSKCF, FROMCENTRALPOINTTOBB 0029 % 0030 % 0031 % [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T. 0032 % Burghardt, A. Paiement, L. Tao, DS-KCF: A real-time tracker for RGB-D 0033 % data, Journal of Real-Time Image Processing 0034 % 0035 % 0036 % University of Bristol 0037 % Massimo Camplani and Sion Hannuna 0038 % 0039 % massimo.camplani@bristol.ac.uk 0040 % hannuna@compsci.bristol.ac.uk 0041 0042 0043 %insert in pos the previous target position... 0044 pos=[trackerDSKCF_structOccluder.previousTarget.posY,trackerDSKCF_structOccluder.previousTarget.posX]; 0045 newPos=pos; 0046 if(firstFrame==false) 0047 0048 %obtain a subwindow for training at newly estimated target position 0049 patch = get_subwindow(im, pos, trackerDSKCF_structOccluder.window_sz); 0050 patch_depth = get_subwindow(depth, pos, trackerDSKCF_structOccluder.window_sz); 0051 nRows=size(im,1); 0052 nCols=size(im,2); 0053 %calculate response of the DS-KCF tracker 0054 [response, maxResponse,newPos]=maxResponseDSKCF(... 0055 patch,patch_depth, DSKCFparameters.features,DSKCFparameters.kernel,... 0056 pos,DSKCFparameters.cell_size, trackerDSKCF_structOccluder.cos_window,... 0057 trackerDSKCF_structOccluder.model_xf,trackerDSKCF_structOccluder.model_alphaf,... 0058 trackerDSKCF_structOccluder.model_xDf,trackerDSKCF_structOccluder.model_alphaDf,... 0059 nRows,nCols); 0060 0061 %update tracker struct, new position etc 0062 trackerDSKCF_structOccluder.currentTarget.posX=newPos(2); 0063 trackerDSKCF_structOccluder.currentTarget.posY=newPos(1); 0064 0065 trackerDSKCF_structOccluder.currentTarget.bb=fromCentralPointToBB... 0066 (trackerDSKCF_structOccluder.currentTarget.posX,trackerDSKCF_structOccluder.currentTarget.posY,... 0067 trackerDSKCF_structOccluder.currentTarget.w,trackerDSKCF_structOccluder.currentTarget.h,... 0068 nCols,nRows); 0069 0070 trackerDSKCF_structOccluder.currentTarget.conf=maxResponse; 0071 0072 end 0073 0074 %obtain a subwindow for training at newly estimated target position 0075 patch = get_subwindow(im, newPos, trackerDSKCF_structOccluder.window_sz); 0076 patch_depth = get_subwindow(depth, newPos, trackerDSKCF_structOccluder.window_sz); 0077 0078 %update occluder model.... 0079 [trackerDSKCF_structOccluder.model_alphaf, trackerDSKCF_structOccluder.model_alphaDf, ... 0080 trackerDSKCF_structOccluder.model_xf, trackerDSKCF_structOccluder.model_xDf]=... 0081 modelUpdateDSKCF(firstFrame,patch,patch_depth,DSKCFparameters.features,... 0082 DSKCFparameters.cell_size,trackerDSKCF_structOccluder.cos_window,... 0083 DSKCFparameters.kernel,trackerDSKCF_structOccluder.yf,... 0084 DSKCFparameters.lambda,trackerDSKCF_structOccluder.model_alphaf, ... 0085 trackerDSKCF_structOccluder.model_alphaDf,trackerDSKCF_structOccluder.model_xf,... 0086 trackerDSKCF_structOccluder.model_xDf,0,DSKCFparameters.interp_factor); 0087