Skip to content

A python class that calculates chamfer distance between point clouds using tensorflow

Notifications You must be signed in to change notification settings

UM-ARM-Lab/Chamfer-Distance-API

Repository files navigation

Chamfer Distance API

Chamfer Distance (CD) is a evaluation metric for two point clouds. It takes the distance of each points into account. For each point in each cloud, CD finds the nearest point in the other point set, and sums the square of distance up. It is utilized in Shapenet’s shape reconstruction challenge.

The chamfer distance between point cloud S1 and S2 is defined as

This readme is a guidance on how to compile the code for chamfer distance and a tutorial to use chamfer distance api.

Prerequisites

Compiling the chamfer-distance code

The folder chamfer-distance contains tensorflow module for chamfer-distance. To compile them, make sure tensorflow is installed. Then, modify the first 4 lines of chamfer-distance/Makefile according to your environment. Finally, compile the chamfer-distance code

# From chamfer-distance/
make

To test the code, try

# From chamfer-distance/
python tf_nndistance.py

Chamfer-Distance-API

After compiling code for tensorflow, we can use the Chamfer Distance API now. Note the chamfer distance is defined as the sum of square of euclidean distance in the API. Try

python chamfer_test.py

which will calculate chamfer distance between point (1, 1, 1) and (1, 1, -1) and output [8.].

Generally, to use the api, use cd_api = Chamfer_distance() to initialize the class, and then use cd_api.get_chamfer_distance(xyz1,xyz2) to calculate the chamfer distance.

References

About

A python class that calculates chamfer distance between point clouds using tensorflow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published