MoI discussion forum
MoI discussion forum

Full Version: Setting camera from 3D scanner

Show messages: All  1-6  7-13

From: bemfarmer
29 Aug 2017   [#7] In reply to [#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
From: Michael Gibson
29 Aug 2017   [#8] In reply to [#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] In reply to [#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] In reply to [#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
From: track
29 Aug 2017   [#11] In reply to [#9]
Thanks this is what I was looking for.
From: bemfarmer
29 Aug 2017   [#12] In reply to [#10]
This link shows Matlab notation which appears to be like rx, ry, rz, as far as I can tell.
https://math.stackexchange.com/questions/219864/matlab-function-rotation-matrix

google search of "matlab rotation matrix 3d" brings up all sorts of good information and code, but your questions were answered by Michael :-)
- Brian
From: track
30 Aug 2017   [#13] In reply to [#12]
Your link is about contructing a rotation matrix along a given axis and with a given angle.
It is a general formula to build a rotation matrix

In my case, rx, ry and rz are three 3D vectors.
They are the rows of my rotation matrix.

Michael answered by question.

Show messages: All  1-6  7-13