How to transform one ArUco marker coordinate system to another?

Assuming there are two ArUco markers in space, we can easily obtain the pose information (rvecs and tvecs) of these two markers through detectMarkers and estimatePoseSingleMarkers. Now, through what kind of rigid transformation(rotation matrix and translation matrix), can one marker coordinate system be transformed into another marker system? I am new to OpenCV, and I am not sure if there are some functions that can do this job. If not, how should I realize this function? Any help is appreciated.


3D rototralsation matrix, also known as euclidean transformation, is a 4x4 matrix composed as 3x4 [R|t] and last row [0, 0, 0, 1], being R the 3x3 3D rotation matrix, an t the translation column vector. Positions are in 4 element vertical vectors in homogeneous coordinates, which in this case are column [x, y, z, 1].

Poses can be represented with this 4x4 matrix. As poses are usually estimated IRT (in reference to) camera, the inverse matrix is the inverse euclidean transformation, meaning camera IRT object. You can compose these transformations to go from one reference to another.