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