[37] | 1 | % auxiliary script for joining particular oscar settings |
---|
| 2 | % |
---|
| 3 | % The current version is still not optimal. It would be good to have |
---|
| 4 | % some nicer version. It is not very automatic and it does not use the configdata |
---|
| 5 | % |
---|
| 6 | % $Id: joinoscars.m,v 1.5 2004/04/06 12:57:57 svoboda Exp $ |
---|
| 7 | % |
---|
| 8 | |
---|
| 9 | clear all; |
---|
| 10 | |
---|
| 11 | datapath = '/home/svoboda/viroomData/oscar/demo_3p3c_p%d/'; |
---|
| 12 | setups = [1:3]; % related to the data path |
---|
| 13 | path2save = '/home/svoboda/viroomData/oscar/oscardemo3/'; |
---|
| 14 | |
---|
| 15 | % Some dirty scale factors to make ETH Oscar setup compatible |
---|
| 16 | % with Leuven libraries |
---|
| 17 | % the coordinates and resolutions will be divided by theses values |
---|
| 18 | scalefactor.cameras = 1; |
---|
| 19 | scalefactor.projectors = 1; |
---|
| 20 | |
---|
| 21 | % the following indexes are related to the setups |
---|
| 22 | idxcams = [1:4]; |
---|
| 23 | idxproj = [5]; |
---|
| 24 | |
---|
| 25 | % load the partial data sets and join them in a consitent way |
---|
| 26 | % tested with three setups, three cameras and one projector each. |
---|
| 27 | % the three cameras are the same for all the particular datasets |
---|
| 28 | Ws = []; IdMat = []; Res = []; |
---|
| 29 | for i=1:size(setups,2), |
---|
| 30 | pts = load([sprintf(datapath,setups(i)),'points.dat']); |
---|
| 31 | proj(1:3*size(setups,2),1:size(pts,2)) = NaN; |
---|
| 32 | proj(i*3-2:i*3,:) = pts(idxproj*3-2:idxproj*3,:); |
---|
| 33 | proj(i*3-2:i*3-1,:) = proj(i*3-2:i*3-1,:)/scalefactor.projectors; |
---|
| 34 | pts(1:3:3*size(idxcams,2),:) = pts(1:3:3*size(idxcams,2),:)/scalefactor.cameras; |
---|
| 35 | pts(2:3:3*size(idxcams,2),:) = pts(2:3:3*size(idxcams,2),:)/scalefactor.cameras; |
---|
| 36 | Ws = [Ws, [pts(1:3*size(idxcams,2),:); proj]]; |
---|
| 37 | id = load([sprintf(datapath,setups(i)),'IdMat.dat']); |
---|
| 38 | projid(1:size(setups,2),1:size(pts,2)) = 0; |
---|
| 39 | projid(i,:)=id(idxproj,:); |
---|
| 40 | IdMat = [IdMat,[id(idxcams,:); projid]]; |
---|
| 41 | Res = [Res; load([sprintf(datapath,setups(i)),'Res.dat'])]; |
---|
| 42 | proj =[]; projid=[]; |
---|
| 43 | end |
---|
| 44 | % The Res matrix needs a special care when putting |
---|
| 45 | % camera and projector resolutions together |
---|
| 46 | Res2 = Res([idxcams,idxproj:size(idxcams,2)+1:end],:); |
---|
| 47 | Res2(idxcams,:) = Res2(idxcams,:)/scalefactor.cameras; |
---|
| 48 | Res2(end-2:end,:) = Res2(end-2:end,:)/scalefactor.projectors; |
---|
| 49 | |
---|
| 50 | % savings |
---|
| 51 | save([path2save,'points.dat'],'Ws','-ASCII'); |
---|
| 52 | save([path2save,'IdMat.dat'],'IdMat','-ASCII'); |
---|
| 53 | save([path2save,'Res.dat'],'Res2','-ASCII'); |
---|
| 54 | |
---|