DISPCLSTRSCORE displays the line clustered scan with scores. DISPCLSTRSCORE displays the line clustered scan with scores. 'score' is an optional input. USAGE: dispclstrscore(angleVector,rangeVector,clstrs,scores); INPUTS: angleVector: 1xN vector; angleVector lists the angles for the ranges in rangeMatrix. rangeVector: 1xN vector; ranges of laser scan clstrs: 1xN vector, cluster numbers of laser points scores: 1xM vector, where M is the number of clusters. 'scores' includes the score for each cluster
0001 function dispclstrscore(theta,ranges,clstrs,score,hflag) 0002 % DISPCLSTRSCORE displays the line clustered scan with scores. 0003 % 0004 % DISPCLSTRSCORE displays the line clustered scan with scores. 'score' is 0005 % an optional input. 0006 % 0007 % USAGE: 0008 % dispclstrscore(angleVector,rangeVector,clstrs,scores); 0009 % 0010 % INPUTS: 0011 % angleVector: 1xN vector; angleVector lists the angles for the ranges 0012 % in rangeMatrix. 0013 % 0014 % rangeVector: 1xN vector; ranges of laser scan 0015 % 0016 % clstrs: 1xN vector, cluster numbers of laser points 0017 % 0018 % scores: 1xM vector, where M is the number of clusters. 'scores' 0019 % includes the score for each cluster 0020 0021 if ~exist('hflag','var') || isempty(hflag) 0022 hflag=0; 0023 end 0024 0025 hold on; 0026 k=max(clstrs); 0027 h=min(clstrs); 0028 noclstrs=k-h+1; 0029 cmap=lines(noclstrs); 0030 [z,x]=pol2cart(theta,ranges); 0031 0032 xcent=zeros(1,k-h+1); 0033 zcent=zeros(1,k); 0034 0035 % get centroids 0036 for cntr=1:noclstrs 0037 xcent(cntr)=mean(x(clstrs==h+cntr-1)); 0038 zcent(cntr)=mean(z(clstrs==h+cntr-1)); 0039 end 0040 0041 if ~exist('score','var') 0042 score=unique(clstrs); 0043 end 0044 0045 0046 for cntr=1:noclstrs 0047 plot(x(clstrs==h+cntr-1),z(clstrs==h+cntr-1),'.','color',cmap(cntr,:)); 0048 % plot(x(clstrs==cntr),z(clstrs==cntr),'color',cmap(cntr,:)); 0049 if noclstrs>2 0050 text(xcent(cntr),zcent(cntr),num2str(score(cntr))); 0051 end 0052 end 0053 0054 0055 plot(0,0,'o'); 0056 % axis manual; 0057 axis image; 0058 xlabel('laser range finder at (0,0), units: mm'); 0059 grid on; 0060 0061 hold off;