ARKit camera Euler Angles rotation order - augmented-reality

I'm new to ARKit, and I need to know what's exactly a rotation order for the camera in ARKit?
I googled a lot for this info but there is no clear answer.
Please I need answer with print example of camera transform matrix.
(Rx, Ry, Rz)
or
(Rz, Ry, Rx) ?

In ARKit, SceneKit and RealityKit the default node's (entity's) orientation is expressed as
pitch, or rotation about X
yaw, or rotation about Y
roll, or rotation about Z
Apple Developer Documentation says:
SceneKit applies these rotations relative to the node’s pivot property in the reverse order of the components: first roll Z, then yaw Y, then pitch X. The rotation, eulerAngles, and orientation properties all affect the rotational aspect of the node’s transform property. Any change to one of these properties is reflected in the others.
Answer
Rotation order for ARKit objects is:
(Rz, Ry, Rx)

Related

Determining perspective distortion from euler angles

I have the readings from a gyroscope attached to a camera describing the orientation of the camera in 3D (say with 3 Euler angles).
I take a picture (of say a flat plane) from this pose. After which, I want to transform the image to another image, as though it has been taken with the camera being perpendicular to the plane itself.
How would I do something like this in OpenCV? Can someone point me in the correct direction?
You can checkout how to calculate the rotation matrix using the roll-pitch-yaw angles here: http://planning.cs.uiuc.edu/node102.html
A Transformation matrix is T = [R t; 0 1] (in matlab notation)
Here, you can place the translation as a 3x1 vector in 't' and the calculated rotation matrix in 'R'.
Since a mathematical information is missing, I assume the Z-axis of the image and the camera are parallel. In this case, you have to add a 90° rotation to either the X or the Y axis to get a perpendicular view. This is to take care of orientation.
perspectiveTransform() function should be helpful thereon.
Check out this question for code insights: How to calculate perspective transform for OpenCV from rotation angles?

Scenekit: Angle between two SCNNode

I am trying to develop a robotic arm tracking system.
I used scenekit to develop the visualization and the control of the system.
The SCNNodes of my system is:
Shoulder--->Upper_arm--->Fore_arm--->Palm.
I could now rotate each node using the rotation property of each SCNNode.
And I am now interested in whether there's any existing API to compute the angle between two SCNNode when the system is moving, eg. the angle between the Upper_arm and Fore_arm?
Try SCNNode.eulerAngles, you will get SCNVector3, which has components:
Pitch (the x component) is the rotation about the node’s x-axis.
Yaw (the y component) is the rotation about the node’s y-axis.
Roll (the z component) is the rotation about the node’s z-axis.
Fore_arm.eulerAngles will give you rotation angles relative to Upper_arm

the difference between the definition of the back camera, and IMU coordinate system of IPhone 6

I'm using some computer vision algorithm to aid the motion sensor (inertial measurements unit [IMU]) that are built on iPhone 6.
Its important to know the difference between the camera and IMU coordinate systems definition.
I'm sure that apple defines the IMU coordinate system as follow:
But I do not know how they define the x,y,z axis of the camera.
my ultimate goal is to transfer the IMU measurement to the camera coordinate system
The trick here is to view the axis from the top and reference it to the Right rotation and notice the rotational movement of the axis. If it doesn't rotate it's positive. If it rotates check the direction of the rotation; if it rotates to the CW then it's negative CCW is positive.

How do I determine the camera rotation in world space (not orientation of a Charuco board) in OpenCV?

In OpenCV, I am using a Charuco board, have calibrated the camera, and use SolvePnP to get rvec and tvec. (similar to the sample code). I am using a stationary board, with a camera on a circular rig which orbits the board. I'm a noob with this, so please bear with me if this is something simple I am missing.
I understand that I can use Rodrigues() to get the 3x3 rotation matrix for the board orientation from rvec, and that I can transform the tvec value into world coordinates using -R.t() * tvec (in c++).
However, as I understand it, this 3x3 rotation R gives the orientation of the board with respect to the camera, so it's not quite what need. I want the rotation of the camera itself, which is offset from R by (I think) the angle between tvec and the z axis in camera space. (because the camera is not always pointing at the board origin, but it is always pointing down the z axis in camera space). Is this correct?
How do I find the additional rotation offset and convert it to a 3x3 rotation matrix which I can combine with R to get the actual camera orientation?
Thanks!
Let's say you capture N frames of the Charuco board from the camera. Then, you have N transformations taking a point in the camera frame to the same point in the Charuco board frame. This is obtained from the Charuco board poses for every frame.
Say we denote a linear transformation from one coordinate frame to another as T4x4 = [R3x3, t3x1; 01x3, 1] If we look at a point P from the board coordinate frame and refer to it as Pboard. Similarly, we look at that point from camera 1 referred to as c1, camera 2 as c2 and so on.
So, we could write:
Pboard = T1Pc1
Pboard = T2Pc2
.
.
.
Pboard = TNPcN
From what I understand, you need camera's rotation say from the starting point (assume that camera is at zero rotation in the frame 1). So, you could express every subsequent frame in terms of Pc1 instead of Pboard.
So, we could say
T2Pc2 = T1Pc1
or, Pc2 = T2-1T1Pc1
Similarly, PcN = TN-1T1Pc1
You could recover RN for taking point from camera position N to camera position 1 by looking at the rotation part of TN-1T1.

Explaining in Detail the ScnVector4 method

I am using 3ds max for a long time and I know xyz axis. what I see in xcode in rotation the scnnode what made my mind blowed up is w component of scnvector4.
Can someone explain in detail how to use this method because I searched a lot of time but I can't make my object spin as I desire. anyone can help to make him spin to his back in 180 degree but I will appreciate if someone explain more for further rotations, Knowing that I saw this link but I didn't understand something.
http://www.cprogramming.com/tutorial/3d/rotationMatrices.html
I believe that your are trying to rotate nodes (rotation property).
From the documentation :
The four-component rotation vector specifies the direction of the rotation axis in the first three components and the angle of rotation (in radians) in the fourth.
You might find it easier to use eulerAngles :
The node’s orientation, expressed as pitch, yaw, and roll angles, each in radians
Use .transform to rotate a node
node.transform = SCNMatrix4Mult(node.transform, SCNMatrix4MakeRotation(angle, x, y, z))
if you want to rotate your node 180 degree by x axis
node.transform = SCNMatrix4Mult(node.transform, SCNMatrix4MakeRotation(Float(M_PI), 1, 0, 0))

Resources