diff options
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/mosaic.m')
-rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/mosaic.m | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/mosaic.m b/SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/mosaic.m new file mode 100755 index 0000000..b056661 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/mosaic.m | |||
@@ -0,0 +1,92 @@ | |||
1 | |||
2 | if ~exist('I_1'), | ||
3 | active_images_save = active_images; | ||
4 | ima_read_calib; | ||
5 | active_images = active_images_save; | ||
6 | check_active_images; | ||
7 | end; | ||
8 | |||
9 | check_active_images; | ||
10 | |||
11 | if isempty(ind_read), | ||
12 | return; | ||
13 | end; | ||
14 | |||
15 | |||
16 | n_col = floor(sqrt(n_ima*nx/ny)); | ||
17 | |||
18 | n_row = ceil(n_ima / n_col); | ||
19 | |||
20 | |||
21 | ker2 = 1; | ||
22 | for ii = 1:n_col, | ||
23 | ker2 = conv(ker2,[1/4 1/2 1/4]); | ||
24 | end; | ||
25 | |||
26 | |||
27 | II = I_1(1:n_col:end,1:n_col:end); | ||
28 | |||
29 | [ny2,nx2] = size(II); | ||
30 | |||
31 | |||
32 | |||
33 | kk_c = 1; | ||
34 | |||
35 | II_mosaic = []; | ||
36 | |||
37 | for jj = 1:n_row, | ||
38 | |||
39 | |||
40 | II_row = []; | ||
41 | |||
42 | for ii = 1:n_col, | ||
43 | |||
44 | if (exist(['I_' num2str(kk_c)])) & (kk_c <= n_ima), | ||
45 | |||
46 | if active_images(kk_c), | ||
47 | eval(['I = I_' num2str(kk_c) ';']); | ||
48 | %I = conv2(conv2(I,ker2,'same'),ker2','same'); % anti-aliasing | ||
49 | I = I(1:n_col:end,1:n_col:end); | ||
50 | else | ||
51 | I = zeros(ny2,nx2); | ||
52 | end; | ||
53 | |||
54 | else | ||
55 | |||
56 | I = zeros(ny2,nx2); | ||
57 | |||
58 | end; | ||
59 | |||
60 | |||
61 | |||
62 | II_row = [II_row I]; | ||
63 | |||
64 | if ii ~= n_col, | ||
65 | |||
66 | II_row = [II_row zeros(ny2,3)]; | ||
67 | |||
68 | end; | ||
69 | |||
70 | |||
71 | kk_c = kk_c + 1; | ||
72 | |||
73 | end; | ||
74 | |||
75 | nn2 = size(II_row,2); | ||
76 | |||
77 | if jj ~= n_row, | ||
78 | II_row = [II_row; zeros(3,nn2)]; | ||
79 | end; | ||
80 | |||
81 | II_mosaic = [II_mosaic ; II_row]; | ||
82 | |||
83 | end; | ||
84 | |||
85 | figure(2); | ||
86 | image(II_mosaic); | ||
87 | colormap(gray(256)); | ||
88 | title('Calibration images'); | ||
89 | set(gca,'Xtick',[]) | ||
90 | set(gca,'Ytick',[]) | ||
91 | axis('image'); | ||
92 | |||