manual_select_cb

PURPOSE ^

MANUAL_SELECT_CB is the callback file that starts the manual selection process.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 MANUAL_SELECT_CB is the callback file that starts the manual selection process.

 MANUAL_SELECT_CB sets up the manual selection process by which the user
 is asked to manually select the calibration board in each laser scan. If
 the calibration images exist in the same folder, they are displayed next
 to each image.
 
 The user can skip a scan by pressing enter. Pressing the letter 'e' will
 interrupt the process.
 Abdallah Kassir 1/3/2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % MANUAL_SELECT_CB is the callback file that starts the manual selection process.
0002 %
0003 % MANUAL_SELECT_CB sets up the manual selection process by which the user
0004 % is asked to manually select the calibration board in each laser scan. If
0005 % the calibration images exist in the same folder, they are displayed next
0006 % to each image.
0007 %
0008 % The user can skip a scan by pressing enter. Pressing the letter 'e' will
0009 % interrupt the process.
0010 % Abdallah Kassir 1/3/2010
0011 
0012 % Make sure data is available
0013 
0014 if ~exist('.\Calib_Results.mat','file')
0015     disp('Calib_Results.mat is needed to proceed.');
0016     return;
0017 end
0018 if ~exist('rangeMatrix','var')
0019     disp('Range data needed, run Read data or Load.');
0020     return;
0021 end
0022 
0023 disp('Manual Selection.');
0024 
0025 % Get intial estimates for the laser-camera transformation
0026 
0027 if ~exist('deltaest','var')
0028     deltaest=[0;0;0];
0029 end
0030 deltaestin=input(['Enter initial estimate for translation vector ([]=',mat2str(deltaest',3),'):']);
0031 if ~isempty(deltaestin)
0032     deltaest=deltaestin(:);  % col vector
0033 end
0034 
0035 if ~exist('phiest','var')
0036     phiest=angvec2dcm([0;0;0]);
0037 end
0038 phiestin=input(['Enter initial estimate for rotation vector ([]=',mat2str(rad2deg(dcm2angvec(phiest))',3),'):']);
0039 if ~isempty(phiestin)
0040     % change into radians and rotation matrix
0041     phiest=angvec2dcm(deg2rad(phiestin(:))); % col vector
0042 end
0043 
0044 % get the planes from the Camera calibration results.
0045 [Nci,BoardCorners]=GetCameraPlanes('Calib_Results.mat',size(rangeMatrix,1));
0046 
0047 
0048 % reset clusters, boardclusters and selectionnumbers
0049 
0050 clstrs=zeros(size(rangeMatrix));
0051 boardclstrs=zeros(size(rangeMatrix,1),1);
0052 selectionnumbers=1:size(rangeMatrix,1);
0053 
0054 % adjust selection numbers to remove invalid scans
0055 vscans=~isnan(Nci(1,:))';
0056 selectionnumbers(selectionnumbers>length(vscans))=[];
0057 selectionnumbers(~vscans(selectionnumbers))=[];
0058 
0059 disp('Press Enter to skip or ''e'' to interrupt process.');
0060 f=figure;
0061 uisuspend(f); % suspend other features
0062 for cntr=selectionnumbers
0063     fprintf('Select points from scan no %d.',cntr);
0064     img=GetImage(cntr);
0065     if ~isempty(img);
0066         maximize(f);
0067         subplot 122;
0068         imshow(img,[]);
0069         subplot 121;
0070     else
0071         fprintf(' Image does not exist.');
0072     end
0073     fprintf('\n');
0074     % adjust display orientation for user convenience
0075     orientation=dcm2angvec(phiest);
0076     orientation=orientation(3);
0077     selind = SelectLaserPoints(angleVector+orientation,rangeMatrix(cntr,:));
0078     clf;
0079     if isempty(selind)
0080         continue;
0081     end
0082     if ~selind
0083         break;
0084     end
0085     clstrs(cntr,:)=selind+1;
0086     boardclstrs(cntr)=2;
0087 end
0088 close(f);
0089 
0090 manclstrs=clstrs;
0091 
0092 % adjust selectionnumbers to remove user skipped ones
0093 selectionnumbers(~boardclstrs(selectionnumbers))=[];
0094 
0095 % display points
0096 dispboardpts(angleVector,rangeMatrix,clstrs,boardclstrs,selectionnumbers);

Generated on Thu 08-Apr-2010 14:35:09 by m2html © 2005