LUT2labelNanSupportCC

PURPOSE ^

LUT2LABELNANSUPPORTCC.m is a function for assign clustering label to the segmented depth image

SYNOPSIS ^

function [L,Cnew,LUTCC]=LUT2labelNanSupportCC(im,LUT,nanMatrix,histStep,C)

DESCRIPTION ^

 LUT2LABELNANSUPPORTCC.m is a function for assign clustering label to the segmented depth image 
 
   LUT2LABELNANSUPPORTCC function creates the clusters'label for all the
   pixels of the segmented depth image. A cluster refinement is performed
   by performing a connected component anaylisis on the image plane. This
   function extends the "Fast segmentation of N-dimensional grayscale
   images" presented by Anton Semechko and shared in the Matlab Central at
   this link under BSD licence
   http://www.mathworks.com/matlabcentral/fileexchange/41967-fast-segmentation-of-n-dimensional-grayscale-images

   INPUT: 
   - im   depth image coded in 16bits, each pixel contains mm data. 
   -LUT is the lookuptable containing cluster label and corresponding
   depth value of the histogram
   -nanMatrix  binary mask containing that marks missing depth pixels 
   -histStep histogram bin used to compose depth histogram
   -C centroids of the depth clusters

   OUTPUT
   - L    label image of the same size as the input image. For example,
           L==i represents the region associated with prototype C(i),
           where i=[1,k] (k = number of clusters).
   -Cnew new centroids of the depth clusters obtained after the connected
   component analysis

   -LUTCC new LUT obtained after the connected component analysis

 See also FASTDEPTHSEGMENTATIONDSKCF_NOISEMODEL

  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 [L,Cnew,LUTCC]=LUT2labelNanSupportCC(im,LUT,nanMatrix,histStep,C)
0002 % LUT2LABELNANSUPPORTCC.m is a function for assign clustering label to the segmented depth image
0003 %
0004 %   LUT2LABELNANSUPPORTCC function creates the clusters'label for all the
0005 %   pixels of the segmented depth image. A cluster refinement is performed
0006 %   by performing a connected component anaylisis on the image plane. This
0007 %   function extends the "Fast segmentation of N-dimensional grayscale
0008 %   images" presented by Anton Semechko and shared in the Matlab Central at
0009 %   this link under BSD licence
0010 %   http://www.mathworks.com/matlabcentral/fileexchange/41967-fast-segmentation-of-n-dimensional-grayscale-images
0011 %
0012 %   INPUT:
0013 %   - im   depth image coded in 16bits, each pixel contains mm data.
0014 %   -LUT is the lookuptable containing cluster label and corresponding
0015 %   depth value of the histogram
0016 %   -nanMatrix  binary mask containing that marks missing depth pixels
0017 %   -histStep histogram bin used to compose depth histogram
0018 %   -C centroids of the depth clusters
0019 %
0020 %   OUTPUT
0021 %   - L    label image of the same size as the input image. For example,
0022 %           L==i represents the region associated with prototype C(i),
0023 %           where i=[1,k] (k = number of clusters).
0024 %   -Cnew new centroids of the depth clusters obtained after the connected
0025 %   component analysis
0026 %
0027 %   -LUTCC new LUT obtained after the connected component analysis
0028 %
0029 % See also FASTDEPTHSEGMENTATIONDSKCF_NOISEMODEL
0030 %
0031 %  University of Bristol
0032 %  Massimo Camplani and Sion Hannuna
0033 %
0034 %  massimo.camplani@bristol.ac.uk
0035 %  hannuna@compsci.bristol.ac.uk
0036 
0037 Cnew=[];
0038 % Intensity range
0039 newPointSet=im(~nanMatrix);
0040 Imin=double(min(newPointSet));
0041 Imax=double(max(newPointSet));
0042 I=(Imin:histStep:Imax)';
0043 
0044 offsetHist=histStep/2;
0045 
0046 LUTCC=[];
0047 %I(end)=Imax;
0048 if(I(end)~=Imax|| length(I)==1)
0049     I(end+1)=Imax+histStep;
0050 end
0051 
0052 
0053 % Create label image
0054 L=zeros(size(im),'uint8');
0055 detectedRegion=0;
0056 startingIndex=1;
0057 for k=1:max(LUT)
0058    
0059     % Intensity range for k-th class
0060     i=find(LUT==k);
0061     if(isempty(i)==false)
0062         i1=i(1);
0063         if numel(i)>1
0064             i2=i(end);
0065         else
0066             i2=i1;
0067         end
0068         
0069         % Map the intensities in the range [I(i1),I(i2)] to class k
0070         bw=im>=I(i1)-offsetHist & im<I(i2)+offsetHist;
0071         [Ltemp num]=bwlabel(bw);
0072         Ltemp=Ltemp+detectedRegion;
0073         detectedRegion=detectedRegion+num;
0074         L(bw)=Ltemp(bw);
0075         Cnew(startingIndex:(startingIndex+num-1))=C(k);
0076         LUTCC(startingIndex:(startingIndex+num-1))=k;
0077         startingIndex=startingIndex+num;
0078     end
0079 end
0080

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