regionModificationCheck

PURPOSE ^

REGIONMODIFICATIONCHECK.m function to identify change of shape as

SYNOPSIS ^

function [estimatedShapeBB,shapeDSKCF_struct,changeOfShapeFlag,newOutput]=regionModificationCheck(sizeOfSegmenter,sizeOfTarget,accumulatedSEGBool,noDataPercent,minSizeOK,estimatedShapeBB,shapeDSKCF_struct,imageSize,trackerDSKCF_struct)

DESCRIPTION ^

 REGIONMODIFICATIONCHECK.m function to identify change of shape as
 presented in [1]


   REGIONMODIFICATIONCHECK is used to estimate significant change of shape
   of the segmented target silhouette, if detected the new shape is used
   as output of the DS-KCF tracker as presented in [1]

   INPUT:
   - sizeOfSegmenter   size of the segmented object
   - sizeOfTarget  size of the tracked target
   - accumulatedSEGBool binary flag to mark if the vector containing the
   segmented masks (see [1]) is full, so the segmentation is considered
   reliable
   -noDataPercent binary flag to identify if the percentage of missing
   depth data is greater than a threshold (set in SINGLEFRAMEDSKCF). In
   case that the flag has value 1 segmentation is not considered reliable
   -minSizeOK binary flag to identify if the size of the object is greater
   than a threshold (set in SINGLEFRAMEDSKCF). In case that the flag has
   value 1 segmentation is not considered reliable
   -estimatedShapeBB boundinbox of the segmented object obtained with the
   accumulation strategy presented in [1]
   -shapeDSKCF_struct data structure containing shape information (see
   INITDSKCFSHAPE)
   - imSize image size
   - trackerDSKCF_struct  DS-KCF tracker data structure (see WRAPPERDSKCF,
   INITDSKCFTRACKER)

   OUTPUT -estimatedShapeBB modified BB of the segmented target
   -shapeDSKCF_struct modified data structure containing shape information
   (see INITDSKCFSHAPE) -changeOfShapeFlag,newOutput flags to mark a
   detected change of shape according to the method presented in [1]

  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 [estimatedShapeBB,shapeDSKCF_struct,changeOfShapeFlag,newOutput]=...
0002     regionModificationCheck(sizeOfSegmenter,sizeOfTarget,accumulatedSEGBool...
0003     ,noDataPercent,minSizeOK,estimatedShapeBB,shapeDSKCF_struct,imageSize...
0004     ,trackerDSKCF_struct)
0005 % REGIONMODIFICATIONCHECK.m function to identify change of shape as
0006 % presented in [1]
0007 %
0008 %
0009 %   REGIONMODIFICATIONCHECK is used to estimate significant change of shape
0010 %   of the segmented target silhouette, if detected the new shape is used
0011 %   as output of the DS-KCF tracker as presented in [1]
0012 %
0013 %   INPUT:
0014 %   - sizeOfSegmenter   size of the segmented object
0015 %   - sizeOfTarget  size of the tracked target
0016 %   - accumulatedSEGBool binary flag to mark if the vector containing the
0017 %   segmented masks (see [1]) is full, so the segmentation is considered
0018 %   reliable
0019 %   -noDataPercent binary flag to identify if the percentage of missing
0020 %   depth data is greater than a threshold (set in SINGLEFRAMEDSKCF). In
0021 %   case that the flag has value 1 segmentation is not considered reliable
0022 %   -minSizeOK binary flag to identify if the size of the object is greater
0023 %   than a threshold (set in SINGLEFRAMEDSKCF). In case that the flag has
0024 %   value 1 segmentation is not considered reliable
0025 %   -estimatedShapeBB boundinbox of the segmented object obtained with the
0026 %   accumulation strategy presented in [1]
0027 %   -shapeDSKCF_struct data structure containing shape information (see
0028 %   INITDSKCFSHAPE)
0029 %   - imSize image size
0030 %   - trackerDSKCF_struct  DS-KCF tracker data structure (see WRAPPERDSKCF,
0031 %   INITDSKCFTRACKER)
0032 %
0033 %   OUTPUT -estimatedShapeBB modified BB of the segmented target
0034 %   -shapeDSKCF_struct modified data structure containing shape information
0035 %   (see INITDSKCFSHAPE) -changeOfShapeFlag,newOutput flags to mark a
0036 %   detected change of shape according to the method presented in [1]
0037 %
0038 %  See also INITDSKCFSHAPE, EXTRACTSEGMENTEDPATCHV3
0039 %
0040 %
0041 %  [1] S. Hannuna, M. Camplani, J. Hall, M. Mirmehdi, D. Damen, T.
0042 %  Burghardt, A. Paiement, L. Tao, DS-KCF: A real-time tracker for RGB-D
0043 %  data, Journal of Real-Time Image Processing
0044 %
0045 %
0046 %  University of Bristol
0047 %  Massimo Camplani and Sion Hannuna
0048 %
0049 %  massimo.camplani@bristol.ac.uk
0050 %  hannuna@compsci.bristol.ac.uk
0051 
0052 %simple case, the segmentar has not grown yet, check for  smaller object or
0053 %a bigger one
0054 newOutput=false;
0055 changeOfShapeFlag=false;
0056 if(accumulatedSEGBool && noDataPercent)
0057     if(shapeDSKCF_struct.growingStatus==false)
0058         
0059         if(sizeOfSegmenter<sizeOfTarget*0.9  && minSizeOK )
0060             estimatedShapeBB=enlargeBB(estimatedShapeBB ,-0.05,imageSize);
0061             shapeDSKCF_struct.growingStatus=false;
0062             newOutput=true;
0063         end
0064         
0065         if(sizeOfSegmenter>sizeOfTarget*1.09 )
0066             %trackerDSKCF_struct.currentTarget.segmentedBB=tmpBBforSegCumulative(:)';
0067             changeOfShapeFlag=true;
0068             newOutput=true;
0069         end
0070     else
0071         
0072         [centerX,centerY,width,height]=fromBBtoCentralPoint(estimatedShapeBB);
0073         estimatedShapeSize=[height,width];
0074         
0075         currentSizeSegmenter=[shapeDSKCF_struct.segmentH,shapeDSKCF_struct.segmentW];
0076         currentSizeMASK=[size(shapeDSKCF_struct.maskArray(:,:,1),1),size(shapeDSKCF_struct.maskArray(:,:,1),2)];
0077         
0078         diffSize=estimatedShapeSize-currentSizeSegmenter;
0079         
0080         growingFlag=(diffSize(1)>0 || diffSize(2)>0);
0081         shrinkingFlag=(diffSize(1)<=0 && diffSize(2)<=0);
0082         %if continues to grow or decrease the size ....then reshape....
0083         
0084         if(growingFlag)
0085             segmentHIncrement=0;
0086             segmentWIncrement=0;
0087             newOutput=true;
0088             if(diffSize(1)>0.07*currentSizeSegmenter(1))
0089                 segmentHIncrement=round(0.05*currentSizeMASK(1));
0090                 shapeDSKCF_struct.growingStatus=true;
0091                 %newOutput=true;
0092             end
0093             
0094             if(diffSize(2)>0.05*currentSizeSegmenter(2))
0095                 segmentWIncrement=round(0.05*currentSizeMASK(2));
0096                 shapeDSKCF_struct.growingStatus=true;
0097                 %newOutput=true;
0098             end
0099             
0100             shapeDSKCF_struct.growingStatus=true;
0101             if(segmentHIncrement>0 || segmentWIncrement>0)
0102                 shapeDSKCF_struct.cumulativeMask=padarray(shapeDSKCF_struct.cumulativeMask,[segmentHIncrement segmentWIncrement]);
0103                 for i=1:size(shapeDSKCF_struct.maskArray,3)
0104                     tmpMaskArray(:,:,i)=...
0105                         padarray(shapeDSKCF_struct.maskArray(:,:,i),[segmentHIncrement segmentWIncrement]);
0106                 end
0107                 shapeDSKCF_struct.maskArray=tmpMaskArray;
0108                 
0109                 shapeDSKCF_struct.segmentW=max([estimatedShapeSize(2),trackerDSKCF_struct.currentTarget.w]);
0110                 shapeDSKCF_struct.segmentH=max([estimatedShapeSize(1),trackerDSKCF_struct.currentTarget.h]);
0111             end
0112             
0113         end
0114         %else if shrink a lot....back to the normal status
0115         if(shrinkingFlag)
0116             
0117             %find the cropping area...
0118             %is inside the target BB?
0119             if(estimatedShapeSize(1)<trackerDSKCF_struct.currentTarget.h ...
0120                     && estimatedShapeSize(2)<trackerDSKCF_struct.currentTarget.w)
0121                 
0122                 bbIn=fromCentralPointToBB(round(currentSizeMASK(2)/2),round(currentSizeMASK(1)/2),...
0123                     estimatedShapeSize(2),estimatedShapeSize(1),...
0124                     currentSizeMASK(2),currentSizeMASK(1));
0125                 
0126                 
0127                 newOutput=false;%decide later what you want to show
0128                 shapeDSKCF_struct.growingStatus=false;
0129                 
0130                 shapeDSKCF_struct.segmentW=trackerDSKCF_struct.currentTarget.w;
0131                 shapeDSKCF_struct.segmentH=trackerDSKCF_struct.currentTarget.h;
0132                 
0133                 
0134                 %reduce the search region
0135                 %grow the mask properly...
0136                 
0137                 tmpCumulativeMask=roiFromBB(shapeDSKCF_struct.cumulativeMask,bbIn);
0138                 segmentHIncrement=round(((1.1*trackerDSKCF_struct.currentTarget.h)-size(tmpCumulativeMask,1))/2);
0139                 
0140                 segmentWIncrement=round(((1.1*trackerDSKCF_struct.currentTarget.w)-size(tmpCumulativeMask,2))/2);
0141                 %be sure >0
0142                 segmentHIncrement=segmentHIncrement*(segmentHIncrement>0);
0143                 segmentWIncrement=segmentWIncrement*(segmentWIncrement>0);
0144                 
0145                 shapeDSKCF_struct.cumulativeMask=padarray(tmpCumulativeMask,[segmentHIncrement segmentWIncrement]);
0146                 for i=1:size(shapeDSKCF_struct.maskArray,3)
0147                     tmpMaskArray(:,:,i)=...
0148                         roiFromBB(shapeDSKCF_struct.maskArray(:,:,i),bbIn);
0149                 end
0150                 shapeDSKCF_struct.maskArray=padarray(tmpMaskArray,[segmentHIncrement segmentWIncrement]);
0151                 
0152                 
0153                 
0154             else
0155                 
0156                 bbIn=fromCentralPointToBB(round(currentSizeMASK(2)/2),round(currentSizeMASK(1)/2),...
0157                     estimatedShapeSize(2),estimatedShapeSize(1),...
0158                     currentSizeMASK(2),currentSizeMASK(1));
0159                 
0160                 newOutput=true;%show this one!!!!!
0161                 shapeDSKCF_struct.growingStatus=true;
0162                 
0163                 shapeDSKCF_struct.segmentW=max([estimatedShapeSize(2),trackerDSKCF_struct.currentTarget.w]);
0164                 shapeDSKCF_struct.segmentH=max([estimatedShapeSize(1),trackerDSKCF_struct.currentTarget.h]);
0165                 
0166                 
0167                 %reduce the search region
0168                 %shrink the masks, but eventually you need to repad the
0169                 %area as the minimun target area
0170                 tmpCumulativeMask=roiFromBB(shapeDSKCF_struct.cumulativeMask,bbIn);
0171                 segmentHIncrement=round(((trackerDSKCF_struct.currentTarget.h)-estimatedShapeSize(1))/2);
0172                 %segmentWIncrement=round(0.05*trackerDSKCF_struct.currentTarget.w);
0173                 segmentWIncrement=round(((trackerDSKCF_struct.currentTarget.w)-estimatedShapeSize(2))/2);
0174                 %be sure >0
0175                 segmentHIncrement=segmentHIncrement*(segmentHIncrement>0);
0176                 segmentWIncrement=segmentWIncrement*(segmentWIncrement>0);
0177                 
0178                 shapeDSKCF_struct.cumulativeMask=padarray(tmpCumulativeMask,[segmentHIncrement segmentWIncrement]);
0179                 for i=1:size(shapeDSKCF_struct.maskArray,3)
0180                     
0181                     tmpMaskArray(:,:,i)=...
0182                         roiFromBB(shapeDSKCF_struct.maskArray(:,:,i),bbIn);
0183                 end
0184                 shapeDSKCF_struct.maskArray=padarray(tmpMaskArray,[segmentHIncrement segmentWIncrement]);
0185                 
0186                 
0187             end
0188             
0189             if(sizeOfSegmenter<sizeOfTarget*0.9  && minSizeOK )
0190                 estimatedShapeBB=enlargeBB(estimatedShapeBB ,-0.05,imageSize);
0191                 shapeDSKCF_struct.growingStatus=false;
0192                 newOutput=true;
0193             end
0194             
0195             
0196         end
0197         
0198         
0199     end
0200 end
0201 
0202 end
0203

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