close Warning: Can't use blame annotator:
svn blame failed on trunk/src/toolbox_calib/ima_read_calib.m: 28 - Can't close file '/tmp/svn-WoAOUp': No space left on device

source: trunk/src/toolbox_calib/ima_read_calib.m @ 734

Last change on this file since 734 was 725, checked in by sommeria, 10 years ago

toolbox_calib added to svn

File size: 2.7 KB
RevLine 
1
2if ~exist('calib_name')|~exist('format_image'),
3   data_calib;
4   return;
5end;
6
7check_directory;
8
9if ~exist('n_ima'),
10   data_calib;
11   return;
12end;
13
14check_active_images;
15
16
17images_read = active_images;
18
19
20if exist('image_numbers'),
21   first_num = image_numbers(1);
22end;
23
24
25% Just to fix a minor bug:
26if ~exist('first_num'),
27   first_num = image_numbers(1);
28end;
29
30
31image_numbers = first_num:n_ima-1+first_num;
32
33no_image_file = 0;
34
35i = 1;
36
37while (i <= n_ima), % & (~no_image_file),
38   
39   if active_images(i),
40   
41        %fprintf(1,'Loading image %d...\n',i);
42   
43        if ~type_numbering,   
44        number_ext =  num2str(image_numbers(i));
45        else
46        number_ext = sprintf(['%.' num2str(N_slots) 'd'],image_numbers(i));
47        end;
48       
49      ima_name = [calib_name  number_ext '.' format_image];
50     
51      if i == ind_active(1),
52         fprintf(1,'Loading image ');
53      end;
54     
55      if exist(ima_name),
56         
57         fprintf(1,'%d...',i);
58         
59         if format_image(1) == 'p',
60            if format_image(2) == 'p',
61               Ii = double(loadppm(ima_name));
62            else
63               Ii = double(loadpgm(ima_name));
64            end;
65         else
66            if format_image(1) == 'r',
67               Ii = readras(ima_name);
68            else
69               Ii = double(imread(ima_name));
70            end;
71         end;
72
73       
74                if size(Ii,3)>1,
75            Ii = 0.299 * Ii(:,:,1) + 0.5870 * Ii(:,:,2) + 0.114 * Ii(:,:,3);
76                end;
77   
78                eval(['I_' num2str(i) ' = Ii;']);
79         
80      else
81         
82         %fprintf(1,'%d...no image...',i);
83         
84         images_read(i) = 0;
85         
86         %no_image_file = 1;
87         
88      end;
89     
90   end;
91   
92   i = i+1;   
93   
94end;
95
96
97ind_read = find(images_read);
98
99
100
101
102if isempty(ind_read),
103   
104   fprintf(1,'\nWARNING! No image were read\n');
105   
106   no_image_file = 1;
107   
108   
109else
110   
111
112   %fprintf(1,'\nWARNING! Every exsisting image in the directory is set active.\n');
113
114   
115   if no_image_file,
116     
117        %fprintf(1,'WARNING! Some images were not read properly\n');
118     
119   end;
120     
121   
122   fprintf(1,'\n');
123
124   if size(I_1,1)~=480,
125        small_calib_image = 1;
126        else
127        small_calib_image = 0;
128        end;
129   
130   [Hcal,Wcal] = size(I_1);     % size of the calibration image
131   
132   [ny,nx] = size(I_1);
133   
134   clickname = [];
135   
136   map = gray(256);
137   
138        %string_save = 'save calib_data n_ima type_numbering N_slots image_numbers format_image calib_name Hcal Wcal nx ny map small_calib_image';
139
140        %eval(string_save);
141
142        disp('done');
143        %click_calib;
144
145end;
146
147if ~(exist('map')==1), map = gray(256); end;
148
149active_images = images_read;
150
Note: See TracBrowser for help on using the repository browser.