


GETIMAGE returns the image of a certain laser scan if it exists.
GETIMAGE uses the camera calibration results to get the image of a
certain laser scan. It returns an empty variable if the image does not
exist.
USAGE:
image=GetImage(imageno);
INPUTS:
imageno: number of laser scan/image
OUTPUTS:
image: image of the laser scan.
Abdallah Kassir 1/3/2010

0001 function image=GetImage(imageno) 0002 % GETIMAGE returns the image of a certain laser scan if it exists. 0003 % 0004 % GETIMAGE uses the camera calibration results to get the image of a 0005 % certain laser scan. It returns an empty variable if the image does not 0006 % exist. 0007 % 0008 % USAGE: 0009 % image=GetImage(imageno); 0010 % 0011 % INPUTS: 0012 % imageno: number of laser scan/image 0013 % 0014 % OUTPUTS: 0015 % image: image of the laser scan. 0016 % 0017 % Abdallah Kassir 1/3/2010 0018 0019 load Calib_Results.mat type_numbering calib_name N_slots format_image; 0020 0021 if ~type_numbering, 0022 number_ext = num2str(imageno); 0023 else 0024 number_ext = sprintf(['%.' num2str(N_slots) 'd'],imageno); 0025 end; 0026 0027 ima_name = [calib_name number_ext '.' format_image]; 0028 0029 if exist(ima_name,'file') 0030 if strcmp(format_image,'pgm') 0031 image = im2double(loadpgm(ima_name)); 0032 elseif strcmp(format_image,'ppm') 0033 image = im2double(loadppm(ima_name)); 0034 elseif strcmp(format_image,'ras') 0035 image = readras(ima_name); 0036 else 0037 image = im2double(imread(ima_name)); 0038 end 0039 else 0040 image=[]; 0041 end