source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/MultiCamValidation/CoreFunctions/workvolume.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.3 KB
Line 
1function [Xmat,idxisa] = workvolume(cam,room,imres,idxcams)
2
3STEP = 0.1;
4
5if nargin < 4
6        idxcams = [1:size(cam,2)];
7end
8
9if nargin < 3
10        imres = repmat([640 480],size(idxcams,2),1);
11end
12imres = imres(idxcams,:);
13
14if nargin < 2
15        % room [x_min, x_max, y_min, y_max, z_min, z_max]
16        room = [-3 3 -3 3 0 3];
17end     
18
19% compose Pmat containing all P matrices
20Pmat = [];
21for i=idxcams,
22        Pmat = [Pmat; cam(i).P];
23end
24
25% create points
26
27zcoor = room(5):STEP:room(6);
28znum = size(zcoor,2);
29ycoor = room(3):STEP:room(4);
30ynum = size(ycoor,2);
31xcoor = room(1):STEP:room(2);
32xnum = size(xcoor,2);
33
34
35buff  = repmat(ycoor,znum,1);
36yvec  = reshape(buff,prod(size(buff)),1);
37zvec  = repmat(zcoor',ynum,1);
38
39buff = repmat(xcoor,znum*ynum,1);
40xvec = reshape(buff,prod(size(buff)),1);
41
42Xmat = [xvec,repmat([yvec,zvec],xnum,1)];
43Xmat = [Xmat,ones(size(Xmat(:,1)))];
44
45clear buff
46
47size(Xmat)
48umat = Pmat*Xmat';
49
50% normalize projected points in umat
51scalemat = [];
52for i=1:size(idxcams,2),
53        scalemat = [scalemat; repmat(umat(3*i,:),3,1)];
54end
55umat = umat./scalemat;
56clear scalemat;
57mask = zeros(size(umat));
58mask(1:3:end,:) = umat(1:3:end,:)<repmat(imres(:,1),1,size(mask,2));
59mask(2:3:end,:) = umat(2:3:end,:)<repmat(imres(:,2),1,size(mask,2));
60mask(3:3:end,:) = 1;
61mask = mask.*(umat>0);
62idxisa = find(sum(mask)==size(mask,1));
63
64return;
65
Note: See TracBrowser for help on using the repository browser.