source: trunk/src/toolbox_calib/data_calib.m @ 975

Last change on this file since 975 was 926, checked in by sommeria, 9 years ago

geometry cqlib updated

File size: 2.6 KB
Line 
1%%% This script alets the user enter the name of the images (base name, numbering scheme,...
2
3     
4% Checks that there are some images in the directory:
5
6l_ras = dir('*ras');
7s_ras = size(l_ras,1);
8l_bmp = dir('*bmp');
9s_bmp = size(l_bmp,1);
10l_tif = dir('*tif');
11s_tif = size(l_tif,1);
12l_pgm = dir('*pgm');
13s_pgm = size(l_pgm,1);
14l_ppm = dir('*ppm');
15s_ppm = size(l_ppm,1);
16l_jpg = dir('*jpg');
17s_jpg = size(l_jpg,1);
18l_jpeg = dir('*jpeg');
19s_jpeg = size(l_jpeg,1);
20
21s_tot = s_ras + s_bmp + s_tif + s_pgm + s_jpg + s_ppm + s_jpeg;
22
23if s_tot < 1,
24   fprintf(1,'No image in this directory in either ras, bmp, tif, pgm, ppm or jpg format. Change directory and try again.\n');
25   return;
26end;
27
28
29% IF yes, display the directory content:
30
31dir;
32
33Nima_valid = 0;
34
35while (Nima_valid==0),
36
37   fprintf(1,'\n');
38   calib_name = input('Basename camera calibration images (without number nor suffix): ','s');
39   
40   format_image = '0';
41   
42        while format_image == '0',
43   
44        format_image =  input('Image format: ([]=''r''=''ras'', ''b''=''bmp'', ''t''=''tif'', ''p''=''pgm'', ''j''=''jpg'', ''m''=''ppm'') ','s');
45               
46                if isempty(format_image),
47                format_image = 'ras';
48                end;
49     
50      if lower(format_image(1)) == 'm',
51         format_image = 'ppm';
52      else
53         if lower(format_image(1)) == 'b',
54            format_image = 'bmp';
55         else
56            if lower(format_image(1)) == 't',
57               format_image = 'tif';
58            else
59               if lower(format_image(1)) == 'p',
60                  format_image = 'pgm';
61               else
62                  if lower(format_image(1)) == 'j',
63                     format_image = 'jpg';
64                  else
65                     if lower(format_image(1)) == 'r',
66                        format_image = 'ras';
67                     else
68                         if lower(format_image(1)) == 'g',
69                             format_image = 'jpeg';
70                         else
71                             disp('Invalid image format');
72                            format_image = '0'; % Ask for format once again
73                         end;
74                     end;
75                  end;
76               end;
77            end;
78         end;
79      end;
80   end;
81
82     
83   check_directory;
84   
85end;
86
87
88
89%string_save = 'save calib_data n_ima type_numbering N_slots image_numbers format_image calib_name first_num';
90
91%eval(string_save);
92
93
94
95if (Nima_valid~=0),
96    % Reading images:
97   
98    ima_read_calib; % may be launched from the toolbox itself
99    % Show all the calibration images:
100   
101    if ~isempty(ind_read),
102       
103        mosaic;
104       
105    end;
106   
107end;
108
Note: See TracBrowser for help on using the repository browser.