Skip to content

Commit

Permalink
Document API of chamfer distance
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonPi committed May 8, 2024
1 parent c01fa2a commit 46b3c87
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pytorch_volumetric/chamfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ def pairwise_distance(world_to_link_tfs: pk.Transform3d):
def pairwise_distance_chamfer(world_to_link_tfs: pk.Transform3d, obj_factory: ObjectFactory = None,
obj_sdf: ObjectFrameSDF = None,
model_points_eval: torch.tensor = None, vis=None, scale=1000):
"""
Compute the pairwise chamfer distance between a set of world to link transforms of an object.
:param world_to_link_tfs: B x 4 x 4 world to link frame transforms
:param obj_factory: object factory to evaluate against
:param obj_sdf: object sdf to evaluate against (accelerates the computation at the cost of accuracy)
:param model_points_eval: points to evaluate the chamfer distance on; if None, sample from the object
:param vis: visualizer
:param scale: units with respect to the position units; e.g. if the position units are in meters, then the scale=1
:return: B x B chamfer distance matrix in squared distance units, averaged across the model_points_eval
"""
if model_points_eval is None:
model_points_eval, _, _ = sample_mesh_points(obj_factory, num_points=500, name=obj_factory.name,
device=world_to_link_tfs.device)
Expand Down

0 comments on commit 46b3c87

Please sign in to comment.