source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/MultiCamValidation/InputOutputFunctions/drawscene.m @ 37

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

Added original make3d

File size: 1.5 KB
Line 
1function drawscene(X,C,R,fig,ctypehint,scenetitle,camsId)
2
3% drawscene ... plots calibration points, cameras and their viewing axes
4%
5% drawscene(X,C,R,fig,ctypehint,scenetitle)
6%
7% X ............ 4xPOINTS matrix containg POINTS object points
8% C ............ 3xCAMS matrix containing the camera centers (in world coord.)
9% R ............ 3*CAMSx3 matrix containing camera rotation matrices
10%                (needed for drawing the viewing axes)
11% fig .......... figure handle (defaults to 1)
12% ctypehint .... calibration object type of X (defaults to 'cloud')
13% scenetitle ... title of the plot (defaults to '')
14% camsIs ....... 1xCAMS vector with cameas Id (default is 1:CAMS
15
16% $Author: svoboda $
17% $Revision: 2.0 $
18% $Id: drawscene.m,v 2.0 2003/06/19 12:07:12 svoboda Exp $
19% $State: Exp $
20
21POINTS = size(X,2);
22CAMS   = size(C,2);
23
24if nargin < 7
25  camsId = [1:CAMS];
26end
27
28if (nargin < 3)
29  error('not enough input arguments');
30end
31if (nargin < 5)
32  scenetitle = '';
33end
34if (nargin < 4)
35  ctypehint = 'cloud';
36end
37
38figure(fig); clf
39title(scenetitle)
40grid on
41axis equal
42
43% plot camera positions (blue)
44drawcloud(C,fig,'b');
45
46% plot calibration object (red)
47drawobject(X,ctypehint,fig,'r');
48
49% Mean of all points
50centroid = mean(X(1:3,:)');
51
52% plot viewing axes
53for i=1:CAMS
54  axis_dir = -R(3*i,:); % 3rd row of i-th rotation matrix
55  axis_len = 0.6*norm(C(1:3,i)-centroid'); 
56  endpoint = C(1:3,i)+axis_len*axis_dir';
57  line([C(1,i),endpoint(1)],[C(2,i),endpoint(2)],[C(3,i),endpoint(3)]);
58  text(C(1,i),C(2,i),C(3,i),sprintf('%4d',camsId(i)),'Color','k');
59end
60
61
Note: See TracBrowser for help on using the repository browser.