isaac_ros_pose_estimation icon indicating copy to clipboard operation
isaac_ros_pose_estimation copied to clipboard

Can you get the real size of the object?

Open missTL opened this issue 11 months ago • 1 comments

Can you get the real size of the object?

missTL avatar Jan 10 '25 07:01 missTL

Real size of the object is actually known encoded in the .obj file. Here's how you can extract it with a script:

import numpy as np

def compute_bbox(obj_file):
    vertices = []
    
    # Read the OBJ file
    with open(obj_file, 'r') as file:
        for line in file:
            parts = line.strip().split()
            if parts and parts[0] == 'v':  # Only process vertex lines
                vertices.append([float(parts[1]), float(parts[2]), float(parts[3])])
    
    vertices = np.array(vertices)
    min_x, min_y, min_z = np.min(vertices, axis=0)
    max_x, max_y, max_z = np.max(vertices, axis=0)
    bbox_size = (max_x - min_x, max_y - min_y, max_z - min_z)
    return bbox_size

# Example usage
obj_filepath = "/home/tomasz/isaac_ros/isaac_ros_assets/isaac_ros_foundationpose/Mustard/textured_simple.obj"
bbox = compute_bbox(obj_filepath)
print(f"Bounding Box Dimensions (X, Y, Z): {bbox}")

Other than that, you can run the demo and do:

ros2 topic echo /pose_estimation/output

But again, you will just get the same hard-coded dimensions as in the .obj file

Hope this helps!

tomasz-lewicki avatar Jan 30 '25 10:01 tomasz-lewicki