% This function displays the results of the doHSM procedure function [f1,f2] = displayHSMResult(result) f1 = figure; % Data points rows=5; cols=1+result.params.maxTHypotheses; subplot(rows,cols, 1:cols); hold on plot(result.params.points1(1,:),result.params.points1(2,:),'b.'); plot(result.params.points2(1,:),result.params.points2(2,:),'g.'); title 'Data points' axis image subplot(rows,cols, 1*cols + (1:cols)); plotHoughTransform(result.ht1, result.params.rhoScale); title 'Hough Transform for first set' subplot(rows,cols, 2*cols + (1:cols)); plotHoughTransform(result.ht2, result.params.rhoScale); title 'Hough Transform for second set' % Spectra correlation subplot(rows,cols, (1:cols)+ cols*3); hold on plotHoughSpectrum(result.hs1, 'b'); plotHoughSpectrum(result.hs2, 'g'); title 'Hough spectra' subplot(rows,cols, (1:cols)+ cols*4); hold on plotHoughSpectrum(result.crossCorrelation, 'k'); plotHoughSpectrum(result.crossCorrelationFiltered, 'r'); title 'Spectra cross-correlation' f2 = figure; % number of results n=size(result.r,2) rows=n; cols=2+result.params.maxTHypotheses; subplot(rows,cols, 1:cols); for i=1:n phi=result.phiHypotheses(i) subplot(rows,cols, 1+(i-1)*cols); colormap bone image( normalize2(result.r(i).tbuffer)'* 63 ); axis('image'); set(gca,'YTick',[]);set(gca,'XTick',[]); title(sprintf('T buffer for \\phi=%d',rad2degi(phi))); subplot(rows,cols, 2+(i-1)*cols); colormap bone image( normalize2(result.r(i).tbufferFiltered)'* 63 ); axis('image'); set(gca,'YTick',[]);set(gca,'XTick',[]); title(sprintf('(filtered)',rad2degi(phi))); points=result.r(i).Tcells; hold on; plot(points(1,:),points(2,:),'rd'); for j=1:size(result.r(i).THypotheses,2) T=result.r(i).THypotheses(:,j); points2back = result.params.points2; % rotate of -phi points2back = rotationMatrix(-phi) * points2back; % translate by -T points2back = points2back - repmat(T,1,size(points2back,2)); subplot(rows,cols, 2+j+(i-1)*cols); hold on plot(points2back(1,:),points2back(2,:), 'g.'); plot(result.params.points1(1,:),result.params.points1(2,:), 'b.'); axis('image'); title(sprintf('T=%0.5g;%0.5g',T(1),T(2))); end end