% proc3d.m - get 3d info from a list of files data_name = input('Base image filename? ([] to break)','s'); if isempty(data_name), return; end load calib_camera load omlist if ~exist('omegalist') | ~exist('fc') | ~exist('cc') | ~exist('kc'), disp(' ERROR - one or more necessary vars couldn''t be loaded from'); disp(' omlist.mat or calib_camera.mat'); return; end while 1, data_spacing = input('Spacing (in steps) between each data image? '); data_spacing = floor(data_spacing); if(data_spacing < 1) | (data_spacing > 100), disp(' INVALID - value must be between 1 and 100'); else break; end end figure; fig1 = gcf; figure; fig2 = gcf; clear allpoints; num=0; omegandx = 1; while 1, fname = strcat(data_name,sprintf('%d',num),'.bmp'); clear im; if exist(fname,'file'), fprintf(1,'Processing %s...\n', fname); im = imread(fname,'bmp'); im = double(im(:,:,1)); figure(fig1); image(im); colormap(gray); ptlist = getpoints(im,cc,fc,kc); depth = recoverdepth(ptlist,omegalist(:,omegandx)); ptlist = [ ptlist(1,:) .* depth ; ptlist(2,:) .* depth ; depth ]; figure(fig2); plot(ptlist(3,:),ptlist(2,:),'r.'); axis('ij'); axis([15 40 -15 10]); if ~exist('allpoints'), allpoints = ptlist; else allpoints = [allpoints ptlist]; end else nfiles = num; break; end % disp('hit a key to continue...'); % pause omegandx = omegandx + data_spacing; num = num+1; end [r,c]=size(allpoints); fprintf(1,'Saving %d 3-D data points in var "allpoints" to %s.mat\n', c, data_name); save(data_name,'allpoints'); figure plot3(allpoints(1,:),allpoints(3,:),-allpoints(2,:),'r.');