Skip to content

Aligning problem when doing evaluation on the replica dataset #101

@Isabel-jin

Description

@Isabel-jin

Hi,thanks for your great work!
I'm trying to doing evaluation on replica using your scripts in replica_eval/eval_recon.py. I did the virualization and found I had problem in aligning the reconstruction mesh with the groundtruth mesh in rotation. I tried using the ICP algorithm offered in your code and tested several different threshlods. But due to the fact that the shape of the replica mesh is like a symethical cuboid, the two meshes always differ in rotation by 180 degrees on one axis. Did you encounter similar problems? Is there any solution in additon to adjust the parameters?

def get_align_transformation(mesh_rec, mesh_gt):
    """
    Get the transformation matrix to align the reconstructed mesh to the ground truth mesh.
    """    
    o3d_gt_mesh = o3d.geometry.TriangleMesh(
        vertices=o3d.utility.Vector3dVector(mesh_gt.vertices),
        triangles=o3d.utility.Vector3iVector(mesh_gt.faces)
    )
    o3d_rec_mesh = o3d.geometry.TriangleMesh(
        vertices=o3d.utility.Vector3dVector(mesh_rec.vertices),
        triangles=o3d.utility.Vector3iVector(mesh_rec.faces)
    )
    o3d_gt_pc = o3d.geometry.PointCloud(points=o3d_gt_mesh.vertices)
    o3d_rec_pc = o3d.geometry.PointCloud(points=o3d_rec_mesh.vertices)
    trans_init = np.eye(4)
    threshold = align_threshold
    reg_p2p = o3d.pipelines.registration.registration_icp(
        o3d_rec_pc, o3d_gt_pc, threshold, trans_init,
        o3d.pipelines.registration.TransformationEstimationPointToPoint(),
        o3d.pipelines.registration.ICPConvergenceCriteria(max_iteration = 3000)
)
    transformation = reg_p2p.transformation
    return transformation


def calc_3d_metric(rec_meshfile, gt_meshfile, align=True):
     ...
     if align:
            transformation = get_align_transformation(mesh_rec, mesh_gt)
            mesh_rec = mesh_rec.apply_transform(transformation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions