LUT2labelNanSupport

PURPOSE ^

LUT2LABELNANSUPPORT.m is a function for assigning clustering label to the segmented depth image

SYNOPSIS ^

function L=LUT2labelNanSupport(im,LUT,nanMatrix,histStep)

DESCRIPTION ^

 LUT2LABELNANSUPPORT.m is a function for assigning clustering label to the segmented depth image 
 
   LUT2LABELNANSUPPORT function creates the clusters'label for all the
   pixels of the segmented depth image. 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

   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).
  

  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=LUT2labelNanSupport(im,LUT,nanMatrix,histStep)
0002 % LUT2LABELNANSUPPORT.m is a function for assigning clustering label to the segmented depth image
0003 %
0004 %   LUT2LABELNANSUPPORT function creates the clusters'label for all the
0005 %   pixels of the segmented depth image. This function extends the "Fast
0006 %   segmentation of N-dimensional grayscale images" presented by Anton
0007 %   Semechko and shared in the Matlab Central at this link under BSD
0008 %   licence
0009 %   http://www.mathworks.com/matlabcentral/fileexchange/41967-fast-segmentation-of-n-dimensional-grayscale-images
0010 %
0011 %   INPUT:
0012 %   - im   depth image coded in 16bits, each pixel contains mm data.
0013 %   -LUT is the lookuptable containing cluster label and corresponding
0014 %   depth value of the histogram
0015 %   -nanMatrix  binary mask containing that marks missing depth pixels
0016 %   -histStep histogram bin used to compose depth histogram
0017 %
0018 %   OUTPUT
0019 %   - L    label image of the same size as the input image. For example,
0020 %           L==i represents the region associated with prototype C(i),
0021 %           where i=[1,k] (k = number of clusters).
0022 %
0023 %
0024 %  University of Bristol
0025 %  Massimo Camplani and Sion Hannuna
0026 %
0027 %  massimo.camplani@bristol.ac.uk
0028 %  hannuna@compsci.bristol.ac.uk
0029 
0030 newPointSet=im(~nanMatrix);
0031 Imin=double(min(newPointSet));
0032 Imax=double(max(newPointSet));
0033 I=(Imin:histStep:Imax)';
0034 %I(end)=Imax;
0035 if(I(end)~=Imax)
0036     I(end+1)=Imax+histStep;
0037 end
0038 % Create label image
0039 L=zeros(size(im),'uint8');
0040 for k=1:max(LUT)
0041    
0042     % Intensity range for k-th class
0043     i=find(LUT==k);
0044     if(isempty(i)==false)
0045         i1=i(1);
0046         if numel(i)>1
0047             i2=i(end);
0048         else
0049             i2=i1;
0050         end
0051         
0052         % Map the intensities in the range [I(i1),I(i2)] to class k
0053         bw=im>=I(i1) & im<=I(i2);
0054         L(bw)=k;
0055     end
0056 end
0057

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