Closed homiec closed 1 week ago
Hi, here is an example of converting 3D BBox to 6DoF pose.
import numpy as np
def bbox_to_pose(points):
"""
Converts a 3D bounding box (8 * 3D points) to a 6 degrees of freedom (6DoF) pose.
Parameters:
points (numpy.ndarray): An array of shape (8, 3) representing the 3D points of the bounding box.
Returns:
translation (numpy.ndarray): A translation vector of shape (3,).
rotation_matrix (numpy.ndarray): A rotation matrix of shape (3, 3).
"""
if points.shape != (8, 3):
raise ValueError("Points array must have shape (8, 3)")
# Calculate the center point (translation vector)
center = np.mean(points, axis=0)
# Compute the rotation matrix
centered_points = points - center
cov_matrix = np.cov(centered_points.T)
eigenvalues, eigenvectors = np.linalg.eig(cov_matrix)
idx = eigenvalues.argsort()[::-1]
rotation_matrix = eigenvectors[:, idx]
return center, rotation_matrix
Thanks for your great work,I have a question about “ 3D referring expression grounding on GAPartNet” in ShapeLLM.
Could you please explain in detail how to do it here? How to convert the 3D bbox generated by ShapeLLM into the 6 DoF pose of GAPartNet?