Quaternion from max and min coordinate values of the Cube?

asked 2020-04-07 23:28:10 -0500

Astronaut gravatar image

updated 2020-04-07 23:28:54 -0500

I am facing some problem in creating the orientation of detected objects. I know the max and min coordinate values (xmin, xmax, ymin, ymax, zmin, zmax). So, I can easily find the vertex of the objects Bounding BOX (Cube) which are

[xmin ymin zmin; 
 xmax ymin zmin; 
 xmax ymax zmin; 
 xmin ymax zmin;
 xmin ymin zmax; 
 xmax ymin zmax; 
 xmax ymax zmax;
 xmin ymax zmax]

Now how can I create the quaternion from axis angle representation in order to get the orientation of the bounding box? I know that a quaternion is a set of 4 numbers, [x y z w], which represents rotations the following way:

// RotationAngle is in radians
x = RotationAxis.x * sin(RotationAngle / 2)
y = RotationAxis.y * sin(RotationAngle / 2)
z = RotationAxis.z * sin(RotationAngle / 2)
w = cos(RotationAngle / 2)

How to get the RotationAxis and RotationAngle when knowing the vertex of the object (in my case is a cube or 3D rectangle)?

Thanks

edit retag flag offensive close merge delete

Comments

Hi, you may want to look at other forums. This is a ROS-specific answers instance and this type of question breaks our guidelines for questions.

stevemacenski gravatar image stevemacenski  ( 2020-04-08 01:12:44 -0500 )edit

Yes I know. But it is still ROS related. As Im using darknet_ros to get the bounding box of the detected objects. So I need to publish the center and orientation of the box.

Astronaut gravatar image Astronaut  ( 2020-04-08 04:48:57 -0500 )edit