summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/mosaic.m
blob: b0566615336e329cc1420b5010b67253d9d8e56a (plain) (blame)
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

if ~exist('I_1'),
   active_images_save = active_images;
   ima_read_calib;
   active_images = active_images_save;
   check_active_images;
end;

check_active_images;

if isempty(ind_read),
   return;
end;


n_col = floor(sqrt(n_ima*nx/ny));

n_row = ceil(n_ima / n_col);


ker2 = 1;
for ii  = 1:n_col,
   ker2 = conv(ker2,[1/4 1/2 1/4]);
end;


II = I_1(1:n_col:end,1:n_col:end);

[ny2,nx2] = size(II);



kk_c = 1;

II_mosaic = [];

for jj = 1:n_row,

	
	II_row = [];
	
	for ii = 1:n_col,
   	
   	if (exist(['I_' num2str(kk_c)])) & (kk_c <= n_ima),
     	
	   if active_images(kk_c),
	      eval(['I = I_' num2str(kk_c) ';']);
	      %I = conv2(conv2(I,ker2,'same'),ker2','same'); % anti-aliasing
	      I = I(1:n_col:end,1:n_col:end);
           else
	      I = zeros(ny2,nx2);
	   end;
	
   	else
      	
      	I = zeros(ny2,nx2);
      	
   	end;
   	
		
   	
   	II_row = [II_row I];
   	
   	if ii ~= n_col,
      
      	II_row = [II_row zeros(ny2,3)];
      
   	end;
   	
   	
   	kk_c = kk_c + 1;
   	
	end;
   
   nn2 = size(II_row,2);
   
   if jj ~= n_row,
      II_row = [II_row; zeros(3,nn2)];
   end;
   
   II_mosaic = [II_mosaic ; II_row];
   
end;

figure(2);
image(II_mosaic);
colormap(gray(256));
title('Calibration images');
set(gca,'Xtick',[])
set(gca,'Ytick',[])
axis('image');