1 | %=======================================================================
|
---|
2 | % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
|
---|
3 | % http://www.legi.grenoble-inp.fr
|
---|
4 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
5 | %
|
---|
6 | % This file is part of the toolbox UVMAT.
|
---|
7 | %
|
---|
8 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
9 | % it under the terms of the GNU General Public License as published
|
---|
10 | % by the Free Software Foundation; either version 2 of the license,
|
---|
11 | % or (at your option) any later version.
|
---|
12 | %
|
---|
13 | % UVMAT is distributed in the hope that it will be useful,
|
---|
14 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
17 | %=======================================================================
|
---|
18 |
|
---|
19 | %%% This script alets the user enter the name of the images (base name, numbering scheme,...
|
---|
20 |
|
---|
21 |
|
---|
22 | % Checks that there are some images in the directory:
|
---|
23 |
|
---|
24 | l_ras = dir('*ras');
|
---|
25 | s_ras = size(l_ras,1);
|
---|
26 | l_bmp = dir('*bmp');
|
---|
27 | s_bmp = size(l_bmp,1);
|
---|
28 | l_tif = dir('*tif');
|
---|
29 | s_tif = size(l_tif,1);
|
---|
30 | l_pgm = dir('*pgm');
|
---|
31 | s_pgm = size(l_pgm,1);
|
---|
32 | l_ppm = dir('*ppm');
|
---|
33 | s_ppm = size(l_ppm,1);
|
---|
34 | l_jpg = dir('*jpg');
|
---|
35 | s_jpg = size(l_jpg,1);
|
---|
36 | l_jpeg = dir('*jpeg');
|
---|
37 | s_jpeg = size(l_jpeg,1);
|
---|
38 |
|
---|
39 | s_tot = s_ras + s_bmp + s_tif + s_pgm + s_jpg + s_ppm + s_jpeg;
|
---|
40 |
|
---|
41 | if s_tot < 1,
|
---|
42 | fprintf(1,'No image in this directory in either ras, bmp, tif, pgm, ppm or jpg format. Change directory and try again.\n');
|
---|
43 | break;
|
---|
44 | end;
|
---|
45 |
|
---|
46 |
|
---|
47 | % IF yes, display the directory content:
|
---|
48 |
|
---|
49 | dir;
|
---|
50 |
|
---|
51 | Nima_valid = 0;
|
---|
52 |
|
---|
53 | while (Nima_valid==0),
|
---|
54 |
|
---|
55 | fprintf(1,'\n');
|
---|
56 | calib_name = input('Basename camera calibration images (without number nor suffix): ','s');
|
---|
57 |
|
---|
58 | format_image = '0';
|
---|
59 |
|
---|
60 | while format_image == '0',
|
---|
61 |
|
---|
62 | format_image = input('Image format: ([]=''r''=''ras'', ''b''=''bmp'', ''t''=''tif'', ''p''=''pgm'', ''j''=''jpg'', ''m''=''ppm'') ','s');
|
---|
63 |
|
---|
64 | if isempty(format_image),
|
---|
65 | format_image = 'ras';
|
---|
66 | end;
|
---|
67 |
|
---|
68 | if lower(format_image(1)) == 'm',
|
---|
69 | format_image = 'ppm';
|
---|
70 | else
|
---|
71 | if lower(format_image(1)) == 'b',
|
---|
72 | format_image = 'bmp';
|
---|
73 | else
|
---|
74 | if lower(format_image(1)) == 't',
|
---|
75 | format_image = 'tif';
|
---|
76 | else
|
---|
77 | if lower(format_image(1)) == 'p',
|
---|
78 | format_image = 'pgm';
|
---|
79 | else
|
---|
80 | if lower(format_image(1)) == 'j',
|
---|
81 | format_image = 'jpg';
|
---|
82 | else
|
---|
83 | if lower(format_image(1)) == 'r',
|
---|
84 | format_image = 'ras';
|
---|
85 | else
|
---|
86 | if lower(format_image(1)) == 'g',
|
---|
87 | format_image = 'jpeg';
|
---|
88 | else
|
---|
89 | disp('Invalid image format');
|
---|
90 | format_image = '0'; % Ask for format once again
|
---|
91 | end;
|
---|
92 | end;
|
---|
93 | end;
|
---|
94 | end;
|
---|
95 | end;
|
---|
96 | end;
|
---|
97 | end;
|
---|
98 | end;
|
---|
99 |
|
---|
100 |
|
---|
101 | check_directory;
|
---|
102 |
|
---|
103 | end;
|
---|
104 |
|
---|
105 |
|
---|
106 |
|
---|
107 | %string_save = 'save calib_data n_ima type_numbering N_slots image_numbers format_image calib_name first_num';
|
---|
108 |
|
---|
109 | %eval(string_save);
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 | if (Nima_valid~=0),
|
---|
114 | % Reading images:
|
---|
115 |
|
---|
116 | ima_read_calib; % may be launched from the toolbox itself
|
---|
117 | % Show all the calibration images:
|
---|
118 |
|
---|
119 | if ~isempty(ind_read),
|
---|
120 |
|
---|
121 | mosaic;
|
---|
122 |
|
---|
123 | end;
|
---|
124 |
|
---|
125 | end;
|
---|
126 |
|
---|