In aruco detection, to obtain orientation of the marker, rvec comes into use. rvec converts rotation vector and rotation vector is converted to euler angles. These three angles are said to be with respect to camera frame. but what does that actually mean ,I am having difficulty to visualize these angles. If anyone would explain or draw it for understanding that would be great.
HI @soumildev26,
could you provide us with more context?
- Are you taking a specific course?
- If yes, which Unit of that course are you taking?
- What specific parts don’t you understand?
- What commands did you execute?
- What output did you expect, and what output the system gave you?
- If not a course, is there a specific Open Class that you are following? If so, which one?
Please help us help you.
the camera is in the air looking down(drone), the aruco marker is placed on the ground.
rvec, tvecs, _ = aruco.estimatePoseSingleMarkers(corners, marker_size, k,distortion_coefficients). what should be the rvec values?
Well, I’m not an expert on this, but this is what I found:
In ArUco marker detection, the rvec
(rotation vector) represents the rotation of the marker in the 3D space relative to the camera. This vector is a compact way to represent rotation, and it can be converted to a rotation matrix or Euler angles for better interpretability.
Understanding the rvec
(Rotation Vector)
- Rotation Vector:
- The
rvec
is a 3D vector that describes the axis of rotation and the angle of rotation about that axis. - The direction of the vector indicates the axis of rotation.
- The magnitude (length) of the vector represents the angle of rotation (in radians).
- From
rvec
to Rotation Matrix:
- The rotation vector can be converted to a 3x3 rotation matrix using the Rodrigues’ rotation formula.
- The rotation matrix transforms points from the marker’s coordinate system to the camera’s coordinate system.
- From
rvec
to Euler Angles:
- Euler angles are a set of three angles that describe the rotation about the x, y, and z axes.
- They provide an intuitive way to understand the orientation but can suffer from gimbal lock.
- Common conventions for Euler angles include roll (rotation around x-axis), pitch (rotation around y-axis), and yaw (rotation around z-axis).
Visualizing the Angles
Imagine the camera frame as a 3D coordinate system with the following axes:
- X-axis: Points to the right of the camera.
- Y-axis: Points downward from the camera.
- Z-axis: Points forward, out of the camera.
When you detect an ArUco marker, its orientation relative to the camera can be understood as follows:
- Roll (Rotation around X-axis):
- The marker tilts left or right.
- Positive roll: Tilt right (clockwise when looking along the x-axis).
- Negative roll: Tilt left (counterclockwise when looking along the x-axis).
- Pitch (Rotation around Y-axis):
- The marker tilts up or down.
- Positive pitch: Tilt downward (clockwise when looking along the y-axis).
- Negative pitch: Tilt upward (counterclockwise when looking along the y-axis).
- Yaw (Rotation around Z-axis):
- The marker rotates left or right.
- Positive yaw: Rotate to the right (clockwise when looking along the z-axis).
- Negative yaw: Rotate to the left (counterclockwise when looking along the z-axis).
Practical Example
Assume an ArUco marker is detected, and you have the following rvec
:
rvec = [0.1, 0.2, 0.3]
- The vector
[0.1, 0.2, 0.3]
suggests a small rotation around an axis that points in the direction of the vector. - The magnitude (length) of this vector is
sqrt(0.1^2 + 0.2^2 + 0.3^2)
, which gives the angle of rotation.
To convert this rvec
to a rotation matrix or Euler angles, you would use functions provided by libraries like OpenCV:
import cv2
import numpy as np
# Convert rvec to rotation matrix
rotation_matrix, _ = cv2.Rodrigues(np.array(rvec))
# Convert rotation matrix to Euler angles (if needed)
# This can be done using additional libraries or custom functions
This process helps you understand how the marker is oriented in the 3D space relative to the camera. By visualizing roll, pitch, and yaw, you can get a clear picture of the marker’s orientation.
@ralves don’t you think I also have chatpgt if you don’t know the answer just let it be. someone who has worked on aruco marker would be able to understand the problem here. camera gives rvec .Actually rodrigues is basically vector geometry and after mathematical derivation we get rotation vector. These rotation vector can be converted to euler angles. Now each of these angles must be between two lines( x of frame 1 and x of frame 2). The problem is that am not getting the correct angles. I think missing some transformation of rotation vector. The yaw(rotaion about z ) should be 0 degree i am getting 90
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.