OCCLUDINGOBJECTSEGDSKCF function for segmenting the occluding object OCCLUDINGOBJECTSEGDSKCF.m is the function that segments the occluding object. For more information about how DSKCF handles occlusions see [1]. Please note that this function was partially built extending the RGBD tracker code presented in [2] and available under under Open Source MIT License at http://tracking.cs.princeton.edu/code.html INPUT: - depthIm current depth image (16BIT) - trackerDSKCF_struct DS-KCF tracker data structure OUTPUT - occBB Bounding box of the occluding object in the format [topLeftX, topLeftY, bottomRightX, bottomRightY] read as [columnIndexTopLeft, rowIndexTopLeft, columnIndexBottomRight, rowIndexBottomRight] See also BB_OVERLAP, ENLARGEBB, ROIFROMBB [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] Shuran Song and Jianxiong Xiao. Tracking Revisited using RGBD Camera: Baseline and Benchmark. 2013. University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 function [occBB] = occludingObjectSegDSKCF(depthIm,trackerDSKCF_struct) 0002 %OCCLUDINGOBJECTSEGDSKCF function for segmenting the occluding object 0003 % 0004 %OCCLUDINGOBJECTSEGDSKCF.m is the function that segments the occluding 0005 %object. For more information about how DSKCF handles occlusions see [1]. 0006 %Please note that this function was partially built extending the RGBD 0007 %tracker code presented in [2] and available under under Open Source MIT 0008 %License at 0009 % http://tracking.cs.princeton.edu/code.html 0010 % 0011 % 0012 % INPUT: 0013 % - depthIm current depth image (16BIT) 0014 % - trackerDSKCF_struct DS-KCF tracker data structure 0015 % 0016 % 0017 % OUTPUT 0018 % - occBB Bounding box of the occluding object in the format [topLeftX, 0019 % topLeftY, bottomRightX, bottomRightY] read as [columnIndexTopLeft, 0020 % rowIndexTopLeft, columnIndexBottomRight, rowIndexBottomRight] 0021 % 0022 % See also BB_OVERLAP, ENLARGEBB, ROIFROMBB 0023 % 0024 % 0025 % [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T. 0026 % Burghardt, A. Paiement, L. Tao, DS-KCF: A real-time tracker for RGB-D 0027 % data, Journal of Real-Time Image Processing 0028 % 0029 % [2] Shuran Song and Jianxiong Xiao. Tracking Revisited using RGBD 0030 % Camera: Baseline and Benchmark. 2013. 0031 % 0032 % University of Bristol 0033 % Massimo Camplani and Sion Hannuna 0034 % 0035 % massimo.camplani@bristol.ac.uk 0036 % hannuna@compsci.bristol.ac.uk 0037 0038 bb=enlargeBB(trackerDSKCF_struct.currentTarget.bb ,0.05,size(depthIm)); 0039 %bb=enlargeBB(bb ,0.05,size(depthMapCurr)); 0040 selectedPix=trackerDSKCF_struct.currentTarget.LabelRegions==trackerDSKCF_struct.currentTarget.regionIndex; 0041 front_depth=roiFromBB(depthIm,bb); 0042 tmpMean=trackerDSKCF_struct.currentTarget.Centers(trackerDSKCF_struct.currentTarget.regionIndex);%mean(depthIm(selectedPix)); 0043 depthVector=double(front_depth(selectedPix)); 0044 tmpStd=std(depthVector); 0045 if(tmpStd<5) 0046 tmpStd=trackerDSKCF_struct.currentTarget.stdDepthObj; 0047 end 0048 0049 occmask=abs(double(depthIm)-tmpMean)<tmpStd; 0050 occmask= occmask & depthIm>0; 0051 %find the main connected component 0052 tarBBProp=regionprops(occmask,'BoundingBox','Area'); 0053 if(isempty(tarBBProp)) 0054 occBB=[]; 0055 else if(length(tarBBProp)==1) 0056 occBB=tarBBProp.BoundingBox; 0057 bbVector=cat(1, tarBBProp.BoundingBox)'; 0058 overlap = bb_overlap(bb,bbVector); 0059 %use extrema points..... 0060 if(overlap>0.15) 0061 occBB=ceil([occBB(1), occBB(2),occBB(1)+occBB(3),occBB(2)+occBB(4)]); 0062 else 0063 occBB=[]; 0064 end 0065 0066 else 0067 areas= cat(1, tarBBProp.Area); 0068 bbVector=cat(1, tarBBProp.BoundingBox)'; 0069 %clean small areas.... 0070 minArea=trackerDSKCF_struct.currentTarget.w*trackerDSKCF_struct.currentTarget.h*0.05; 0071 areaSmallIndex=areas<minArea; 0072 %exclude the small area index!!!!!!!! 0073 bbVector(:,areaSmallIndex) = []; 0074 bbVector(3:4,:)=bbVector(1:2,:)+bbVector(3:4,:); 0075 areas(areaSmallIndex)= []; 0076 overlap = bb_overlap(bb,bbVector); 0077 [maxV,maxIndex]=max(overlap); 0078 if(maxV>-100)%(maxV>0) 0079 occBB=bbVector(:,maxIndex)'; 0080 else 0081 occBB=[]; 0082 end 0083 0084 end 0085 0086 occBB=occBB'; 0087 0088 0089 end 0090