Setting camera from 3D scanner

 From: track 29 Aug 2017  (1 of 13)
 Hi I'm trying to set the camera of Moi to have the same position and orientation as the one I have with a 3D scanner. The 3D scanner gives me R and T for a camera. (Each point is transformed as R * P + T). I know the position of the camera which is given by Xc = -tranpose(R) * T The viewing direction is given by the third row and the up vector is given by the second row. How can set them in Moi ?

 From: bemfarmer 29 Aug 2017  (2 of 13)
 8566.2 In reply to 8566.1 Hi track, Camera position (eye point), Lookat point, Focal Length Viewport, vp Field of view Angle, (1/2?), are setup in Michaels script here: http://moi3d.com/forum/index.php?webtag=MOI&msg=8476.3 As I know little about cameras, I'm going to do some Wikipedia reading:-) - Brian

 From: track 29 Aug 2017  (3 of 13)
 8566.3 In reply to 8566.2 Thanks I already saw that I can set the eye and lookat position with this script. But I don't know how to set the leftRightAngle, upDownAngle and tiltAngle to get the correct orientation with the matrix R,T

 From: bemfarmer 29 Aug 2017  (4 of 13)
 8566.4 In reply to 8566.1 Hi track, Do you have a link to the mathematics, the matrix, and the scanner setup? R = rotation matrix? Is the camera or the target rotating? P = a point? T = a translation, or movement of the camera? - Brian

 From: bemfarmer 29 Aug 2017  (5 of 13)
 8566.5 In reply to 8566.3 Hi track, Isn't the left/right angle = field of view angle (x2?). The other two look like they could be calculated by doing some trigonometry math? Can you better describe the terms and the matrix, and the camera/laser/target setup, or do you have a link with pictures? - Brian

 From: track 29 Aug 2017  (6 of 13)
 8566.6 In reply to 8566.5 I know how to compute the field of view from the intrinsic parameters of the camera. I know: 1) How to compute and set the eye position from my (R, T) matrix 2) How to compute and set the lookat position from my (R,T) matrix 3) How to compute and set the field of view from the internal matrix K In a 3D scanner, the application reconstructs a 3D model and computes the position/orientation of each camera (R, T). For each point of the 3D model X , we have the following transformations (using matlab notation): (u, v, w)' = K * (R * X + T) with K = [ fx 0 cx; 0 fy cy; 0 0 1] R = [rx; ry; rz] and T fx, fy are focal length cx, cy principal point (the centre of projection) R rotation matrix, T translation vector that map points in 3D world in the camera space. u, v projection in the image From this equation, it is easy to see that the position of the camera expressed in 3D world is -R'*T The viewing direction expressed in the 3D world is rz, the "up" vector is ry and the "right" vector is rx. Today in Moi, I can set the position, the target and the field of view. But I don't know how to handle the leftRightAngle, upDownAngle and tiltAngle to get the same orientation.

 From: bemfarmer 29 Aug 2017  (7 of 13)
 8566.7 In reply to 8566.6 I need more study and information. [rx, ry, rz] is "arbitrary rotation axis," not a rotation matrix, but [Rx] [Ry] and [Rz] can be individual 3x3 rotation matrices. So the camera rotates left to right, and tilts up and down, and could also roll, and also Translate in 3d space. The laser is rigidly mounted to the camera at some distance D from the camera? The target sits at say the origin. This link has pitch and roll trig: https://pdfs.semanticscholar.org/3046/e4b57081ce9fd51b6a96012219f454ac3e88.pdf - Brian EDITED: 29 Aug 2017 by BEMFARMER

 From: Michael Gibson 29 Aug 2017  (8 of 13)
 8566.8 In reply to 8566.3 Hi track, > I already saw that I can set the eye and lookat position with this script. > But I don't know how to set the leftRightAngle, upDownAngle and tiltAngle to get the correct orientation with the matrix R,T You wouldn't set leftRightAngle and upDownAngle if you're setting the eye and lookat position already. The leftRightAngle and upDownAngle are basically just a way to use sphereical coordinates to set the viewing direction, you would use one of those methods or the other to define the camera direction, not both. But the eye and lookat positions will only define a viewing direction and not a "roll" (https://en.wikipedia.org/wiki/Aircraft_principal_axes) around that direction, that is what tiltAngle can be used to set though. - Michael

 From: Michael Gibson 29 Aug 2017  (9 of 13)
 8566.9 In reply to 8566.6 Hi track, > The viewing direction expressed in the 3D world is rz, the "up" vector is ry and the "right" vector is rx. > > Today in Moi, I can set the position, the target and the field of view. But I don't know how to handle the > leftRightAngle, upDownAngle and tiltAngle to get the same orientation. So hopefully this is correct, I'm not thoroughly double checking it at the moment, but once you have set the position and target in MoI the viewing direction should match your rz and that also means you don't want to mess with the leftRightAngle and upDownAngle after that since they are alternate ways of setting the viewing direction. Then tiltAngle will control the "up" direction's rotation around the view direction with respect to the world z axis direction. The way the tilt angle is calculated is like this: TempRight = CrossProduct( ViewDir, WorldZAxis ) if (TempRight.isDegenerate() ) TempRight = CrossProduct( ViewDir, WorldYAxis ) TempRight.Normalize() NoTiltUpDir = CrossProduct( TempRight, ViewDir ).Normalize(); That's what will be the view's up direction for a "tiltAngle" of 0, you'd need to measure the angle between your view's up direction and that to get the angle to set to make them match. Hope that helps! - Michael

 From: track 29 Aug 2017  (10 of 13)
 8566.10 In reply to 8566.7 [rx; ry; rz] is a general rotation matrix. I'm using matlab notation rx is the first row of my rotation matrix. ry is the second row of my rotation matrix ry is the third row of my rotation matrix In my scanner there is no laser