39
39
% --Translation--
40
40
% Camera 1 (west side)
41
41
Cx1 = 0 ;
42
- Cy1 = ay / 2 ; % centered in y dim
42
+ Cy1 = ay / 2 - 500 ; % centered in y dim
43
43
Cz1 = az ;
44
44
C1 = [Cx1 ; Cy1 ; Cz1 ];
45
45
46
46
% Camera 2 (east side)
47
47
Cx2 = ax ;
48
- Cy2 = ay / 2 ;
48
+ Cy2 = ay / 2 - 500 ;
49
49
Cz2 = az ;
50
50
C2 = [Cx2 ; Cy2 ; Cz2 ];
51
51
52
52
% --Rotation--
53
53
% Camera 1
54
54
thx1 = 0 ;
55
- thy1 = pi / 1.5 ; % point 45 deg down
55
+ thy1 = 0.6 * pi ; % point 45 deg down
56
56
thz1 = 0 ;
57
57
Rcx1 = [1 0 0 ; 0 cos(thx1 ) - sin(thx1 ); 0 sin(thx1 ) cos(thx1 )];
58
58
Rcy1 = [cos(thy1 ) 0 sin(thy1 ); 0 1 0 ; - sin(thy1 ) 0 cos(thy1 )];
59
59
Rcz1 = [cos(thz1 ) - sin(thz1 ) 0 ; sin(thz1 ) cos(thz1 ) 0 ; 0 0 1 ];
60
60
Rc1 = Rcx1 * Rcy1 * Rcz1 ;
61
61
62
62
% Camera 2
63
- thx2 = 0 ;
64
- thy2 = - pi / 1.5 ; % point 45 deg down
63
+ thx2 = 0.15 * pi ;
64
+ thy2 = - 0.6667 * pi ; % point 45 deg down
65
65
thz2 = pi ;
66
66
Rcx2 = [1 0 0 ; 0 cos(thx2 ) - sin(thx2 ); 0 sin(thx2 ) cos(thx2 )];
67
67
Rcy2 = [cos(thy2 ) 0 sin(thy2 ); 0 1 0 ; - sin(thy2 ) 0 cos(thy2 )];
173
173
% now triangulate to find the 3d location again, using the camera matrices
174
174
M = triangulateJYB(P1 ,[c1x + na * randn c1y + na * randn ],P2 ,[c2x + na * randn c2y + na * randn ]);
175
175
plot3(M(1 ),M(2 ),M(3 ),' ro' );
176
+
177
+ fprintf(' P1 = np.array([[%f ,%f ,%f ,%f ],[%f ,%f ,%f ,%f ],{%f ,%f ,%f ,%f ]])\n ' , ...
178
+ P1(1 ,1 ),P1(1 ,2 ),P1(1 ,3 ),P1(1 ,4 ),...
179
+ P1(2 ,1 ),P1(2 ,2 ),P1(2 ,3 ),P1(2 ,4 ),...
180
+ P1(3 ,1 ),P1(3 ,2 ),P1(3 ,3 ),P1(3 ,4 ));
181
+ fprintf(' P2 = np.array([[%f ,%f ,%f ,%f ],[%f ,%f ,%f ,%f ],{%f ,%f ,%f ,%f ]])\n ' , ...
182
+ P2(1 ,1 ),P2(1 ,2 ),P2(1 ,3 ),P2(1 ,4 ),...
183
+ P2(2 ,1 ),P2(2 ,2 ),P2(2 ,3 ),P2(2 ,4 ),...
184
+ P2(3 ,1 ),P2(3 ,2 ),P2(3 ,3 ),P2(3 ,4 ));
0 commit comments