addSegmentationResults

PURPOSE ^

ADDSEGMENTATIONRESULTS.m function manage the alignment of segmented

SYNOPSIS ^

function [ dskcfShapeStruct ] = addSegmentationResults( dskcfShapeStruct,lastMask,tmpBB,trackOffset,imSize)

DESCRIPTION ^

 ADDSEGMENTATIONRESULTS.m function manage the alignment of segmented
 patches to accumulate object binary masks as in [1]


   ADDSEGMENTATIONRESULTS is used to accumulate the segmented target
   masks and align them correctly in case of target close to the borders
   for example or change in scale while those silhouette are accumulated

   INPUT:
   - lastMask   segmented binary mask of the current frame processed by
   EXTRACTSEGMENTEDPATCHV3 to be accumulated with the other masks as in
   [1] without any errors due to change of shape or false segmentation,
   masks are centered and then accumulated
   - tmpBB  bounding box containing the segmented patch in the format
   [topLeftX, topLeftY, bottomRightX, bottomRightY] read as
   [columnIndexTopLeft, rowIndexTopLeft, columnIndexBottomRight,
   rowIndexBottomRight]  
   - trackOffset boundinbox of patch in case of offset
   -dskcfShapeStruct data structure containing shape information (see INITDSKCFSHAPE) 
   - imSize image size
   OUTPUT
   -dskcfShapeStruct modified data structure containing shape information (see INITDSKCFSHAPE) 

  See also INITDSKCFSHAPE, EXTRACTSEGMENTEDPATCHV3


  [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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ dskcfShapeStruct ] = addSegmentationResults( dskcfShapeStruct,lastMask,tmpBB,trackOffset,imSize)
0002 % ADDSEGMENTATIONRESULTS.m function manage the alignment of segmented
0003 % patches to accumulate object binary masks as in [1]
0004 %
0005 %
0006 %   ADDSEGMENTATIONRESULTS is used to accumulate the segmented target
0007 %   masks and align them correctly in case of target close to the borders
0008 %   for example or change in scale while those silhouette are accumulated
0009 %
0010 %   INPUT:
0011 %   - lastMask   segmented binary mask of the current frame processed by
0012 %   EXTRACTSEGMENTEDPATCHV3 to be accumulated with the other masks as in
0013 %   [1] without any errors due to change of shape or false segmentation,
0014 %   masks are centered and then accumulated
0015 %   - tmpBB  bounding box containing the segmented patch in the format
0016 %   [topLeftX, topLeftY, bottomRightX, bottomRightY] read as
0017 %   [columnIndexTopLeft, rowIndexTopLeft, columnIndexBottomRight,
0018 %   rowIndexBottomRight]
0019 %   - trackOffset boundinbox of patch in case of offset
0020 %   -dskcfShapeStruct data structure containing shape information (see INITDSKCFSHAPE)
0021 %   - imSize image size
0022 %   OUTPUT
0023 %   -dskcfShapeStruct modified data structure containing shape information (see INITDSKCFSHAPE)
0024 %
0025 %  See also INITDSKCFSHAPE, EXTRACTSEGMENTEDPATCHV3
0026 %
0027 %
0028 %  [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T.
0029 %  Burghardt, A. Paiement, L. Tao, DS-KCF: A real-time tracker for RGB-D
0030 %  data, Journal of Real-Time Image Processing
0031 %
0032 %
0033 %  University of Bristol
0034 %  Massimo Camplani and Sion Hannuna
0035 %
0036 %  massimo.camplani@bristol.ac.uk
0037 %  hannuna@compsci.bristol.ac.uk
0038 
0039 dskcfShapeStruct.lastSegmentedBB=tmpBB;
0040 
0041 if(isempty(dskcfShapeStruct.cumulativeBB))
0042     
0043     dskcfShapeStruct.cumulativeBB=dskcfShapeStruct.lastSegmentedBB;
0044     dskcfShapeStruct.maskArray=cat(3,dskcfShapeStruct.maskArray,lastMask);
0045     dskcfShapeStruct.cumulativeMask=lastMask;
0046 else
0047     %%subtract
0048     if(size(dskcfShapeStruct.maskArray,3)<(dskcfShapeStruct.slidingWindowSize))
0049         dskcfShapeStruct.maskArray=cat(3,dskcfShapeStruct.maskArray,lastMask);
0050         dskcfShapeStruct.cumulativeMask=dskcfShapeStruct.cumulativeMask | lastMask;
0051     else
0052         dskcfShapeStruct.maskArray=cat(3,dskcfShapeStruct.maskArray(:,:,2:dskcfShapeStruct.slidingWindowSize),lastMask);
0053         dskcfShapeStruct.cumulativeMask=dskcfShapeStruct.maskArray(:,:,1);
0054         for i=2:size(dskcfShapeStruct.maskArray,3)
0055             dskcfShapeStruct.cumulativeMask=dskcfShapeStruct.cumulativeMask | dskcfShapeStruct.maskArray(:,:,i);
0056         end
0057     end
0058     tmpProp=regionprops(dskcfShapeStruct.cumulativeMask,'BoundingBox','area');
0059     areaList= cat(1, tmpProp.Area);
0060     [maxV,maxI]=max(areaList);
0061     if(isempty(areaList))
0062         tmpBB=dskcfShapeStruct.cumulativeBB;
0063     else
0064         tmpBB=tmpProp(maxI).BoundingBox;
0065         tmpBB=ceil([tmpBB(1),tmpBB(2),tmpBB(1)+tmpBB(3),tmpBB(2)+tmpBB(4)]);
0066 
0067         tmpBB(1)=max(1,tmpBB(1)+trackOffset(1));
0068         tmpBB(3)=min(imSize(2),tmpBB(3)+trackOffset(1));
0069 
0070         tmpBB(2)=max(1,tmpBB(2)+trackOffset(2));
0071         tmpBB(4)=min(imSize(1),tmpBB(4)+trackOffset(2));
0072 
0073     end
0074     dskcfShapeStruct.cumulativeBB=tmpBB;
0075 
0076 end
0077 
0078 
0079 end
0080

Generated on Thu 24-Nov-2016 18:03:21 by m2html © 2005