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 | |
---|
6 | l_ras = dir('*ras'); |
---|
7 | s_ras = size(l_ras,1); |
---|
8 | l_bmp = dir('*bmp'); |
---|
9 | s_bmp = size(l_bmp,1); |
---|
10 | l_tif = dir('*tif'); |
---|
11 | s_tif = size(l_tif,1); |
---|
12 | l_pgm = dir('*pgm'); |
---|
13 | s_pgm = size(l_pgm,1); |
---|
14 | l_ppm = dir('*ppm'); |
---|
15 | s_ppm = size(l_ppm,1); |
---|
16 | l_jpg = dir('*jpg'); |
---|
17 | s_jpg = size(l_jpg,1); |
---|
18 | l_jpeg = dir('*jpeg'); |
---|
19 | s_jpeg = size(l_jpeg,1); |
---|
20 | |
---|
21 | s_tot = s_ras + s_bmp + s_tif + s_pgm + s_jpg + s_ppm + s_jpeg; |
---|
22 | |
---|
23 | if 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; |
---|
26 | end; |
---|
27 | |
---|
28 | |
---|
29 | % IF yes, display the directory content: |
---|
30 | |
---|
31 | dir; |
---|
32 | |
---|
33 | Nima_valid = 0; |
---|
34 | |
---|
35 | while (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 | |
---|
85 | end; |
---|
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 | |
---|
95 | if (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 | |
---|
107 | end; |
---|
108 | |
---|