1 | function [align] = bluecrz(in,config) |
---|
2 | % bluecrz ... localized output function for the BlueCRZ installation |
---|
3 | % |
---|
4 | % [align] = bluecrz(in,config) |
---|
5 | % in, cam, config ... see the main GOCAL script |
---|
6 | % |
---|
7 | % align ... structures aligned wit the specified world frame |
---|
8 | % |
---|
9 | % $Id: bluecrz.m,v 2.1 2005/05/20 15:27:37 svoboda Exp $ |
---|
10 | |
---|
11 | Cst = in.Cst; |
---|
12 | Rot = in.Rot; |
---|
13 | |
---|
14 | drawscene(in.Xe,Cst',Rot,41,'cloud','Graphical Output Validation: View from top or bottom',config.cal.cams2use); |
---|
15 | |
---|
16 | horizplane.idx(1) = find(config.cal.cams2use==9); |
---|
17 | horizplane.idx(2) = find(config.cal.cams2use==10); |
---|
18 | horizplane.idx(3) = find(config.cal.cams2use==17); |
---|
19 | horizplane.idx(4) = find(config.cal.cams2use==18); |
---|
20 | horizplane.vec = pinv([Cst(horizplane.idx,1:2),ones(size(horizplane.idx))'])*Cst(horizplane.idx,3); |
---|
21 | horizplane.par = [-horizplane.vec(1),-horizplane.vec(2),1,-horizplane.vec(3)]; |
---|
22 | horizplane.n = horizplane.par(1:3)'; |
---|
23 | |
---|
24 | % set the camera on top |
---|
25 | set(gca,'CameraTarget',mean(Cst(horizplane.idx,:))); |
---|
26 | set(gca,'CameraPosition',mean(Cst(horizplane.idx,:))+3*horizplane.n'); |
---|
27 | % figure(41), print -depsc grapheval.eps |
---|
28 | |
---|
29 | % definition of the absolute world frame |
---|
30 | cave.x=2.8; cave.y=2.8; cave.z=2.36; |
---|
31 | cam(9).C = [cave.x/2, -cave.y/2, cave.z]'; |
---|
32 | cam(10).C = [cave.x/2, cave.y/2, cave.z]'; |
---|
33 | cam(17).C = [-cave.x/2, -cave.y/2, cave.z]'; |
---|
34 | cam(18).C = [-cave.x/2, cave.y/2, cave.z]'; |
---|
35 | cam(4).C = [0,0.05,3.7]'; % relatively ad hoc values to improve the stability |
---|
36 | % of the similarity computation |
---|
37 | |
---|
38 | [align.simT.s, align.simT.R, align.simT.t] = estsimt([Cst(find(config.cal.cams2use==4),:)',Cst(horizplane.idx,1:3)'],[cam(:).C]); |
---|
39 | [align.P, align.X] = align3d(in.Pe,in.Xe,align.simT); |
---|
40 | % save aligned data |
---|
41 | if 1 % SAVE_STEPHI | SAVE_PGUHA |
---|
42 | [align.Cst,align.Rot] = savecalpar(align.P,config); |
---|
43 | end |
---|
44 | % plot the 3D results from a better perspective by estimating the plane of the Cams 9,10,17,18 |
---|
45 | % let call this plane "horizontal". |
---|
46 | % this plot makes sense only for the BigBlueC |
---|
47 | horizplane.vec = pinv([align.Cst(horizplane.idx,1:2),ones(size(horizplane.idx))'])*align.Cst(horizplane.idx,3); |
---|
48 | horizplane.par = [-horizplane.vec(1),-horizplane.vec(2),1,-horizplane.vec(3)]; |
---|
49 | horizplane.n = horizplane.par(1:3)'; |
---|
50 | drawscene(align.X,align.Cst',align.Rot,61,'cloud','Graphical Output Validation: View from the top camera',config.cal.cams2use); |
---|
51 | % set the camera on top |
---|
52 | set(gca,'CameraTarget',mean(align.Cst(horizplane.idx,:))); |
---|
53 | set(gca,'CameraPosition',mean(align.Cst(horizplane.idx,:))+3*horizplane.n'); |
---|
54 | % set(gca,'CameraPosition',align.Cst(find(config.cal.cams2use==4),:)); % view from the perspective of the camera4 |
---|
55 | |
---|
56 | % drawscene(in.Xe,Cst',Rot,42,'cloud','Graphical Output Validation: View from side',config.cal.cams2use); |
---|
57 | % set(gca,'CameraTarget',mean(Cst(horizplane.idx,:))); |
---|
58 | % set(gca,'CameraPosition',mean(Cst(horizplane.idx,:)+Cst(horizplane(4),:)-Cst(horizplane(1),:))'); |
---|
59 | |
---|
60 | figure(61), |
---|
61 | % print -depsc graphevalaligned.eps |
---|
62 | eval(['print -depsc ', config.paths.data, 'graphevalaligned.eps']) |
---|
63 | |
---|
64 | return; |
---|