Definitioncore
Chamfer distance between point sets
Also called symmetric chamfer distance.
The sum over both point sets of the squared distance from each point to its nearest point in the other set: a common loss and score for point clouds, but not a metric.
The chamfer distance between two finite point sets measures how far each point of one set is from the nearest point of the other, in both directions, and adds it all up. It is cheap to compute with a nearest neighbour search, it needs no correspondence between the points, and it has a gradient almost everywhere. For these reasons it is the standard loss for neural networks that output point clouds, and a common score for how well a reconstruction or a registration fits. This page uses the form of Fan, Su and Guibas (2017): squared distances, summed over the points of both sets. Other papers use means instead of sums, or plain distances instead of squared ones; these forms differ by constant factors or in their sensitivity to far points, and a paper should always say which one it uses. The name comes from chamfer matching in images (Barrow et al., 1977), which is a different, one-sided measure on an image grid.
Definition
Let and be finite, nonempty subsets of . The chamfer distance is
Each sum is a one-sided chamfer distance: the first says how well covers the points of , and the second how well covers the points of .
Other forms in use:
- Mean form. Divide each sum by the size of its set, . Many libraries compute this form, so that the value does not grow with the number of points.
- Plain distances. Use instead of its square. A far point then counts less, and the value has the units of a length.
- One-sided form. Keep only one of the two sums, for example when is a full model and a partial scan of it.
Properties. is symmetric, it is at least 0, and it is 0 exactly when : if it is 0, every point of each set lies in the other. It is not a metric, because it breaks the triangle inequality, as the examples show. It ignores how many times a point is repeated, so it does not compare densities.
Cost. By brute force it takes time. With a k-d tree on each set and , the nearest neighbour queries take time each on well spread points in low dimension, so about in all.
Examples and non-examples
A small case. In the plane, let and .
| Point | Set | Nearest in the other set | Squared distance |
|---|---|---|---|
| 1 | |||
| 1 | |||
| 1 | |||
| 1 | |||
| 2 |
So . The mean form gives , and the form with plain distances gives . The Hausdorff distance, the largest of these nearest distances, is .
The triangle inequality fails. On the line, let , and . Then , but . The squares cause this. The form with plain distances fails too, for another reason: with , and , it gives from to , but only from to plus from to . Each point of adds its own term, so a set with many points far from a small set gets a large value.
Density is not seen. Let be 100 points spread evenly on a segment, and the same 100 points plus 900 more points packed near one end. Each point of has a near point in , and each point of lies in , so the chamfer distance is small, although the two sets sample the segment in very different ways. A measure that moves mass from one set to the other, such as the earth mover's distance with equal total weight on each set, sees this difference.
Not the image chamfer distance. The chamfer distance transform of an image gives each pixel an approximate distance to the nearest edge pixel, by two raster passes with small integer weights. Chamfer matching (Barrow et al., 1977) scores an edge template at a pose by the values of such a distance transform under the template points. That score is one-sided, from the template to the image, and it lives on a pixel grid. The point set chamfer distance is two-sided and uses exact Euclidean distances between points.
Related definitions
- Hausdorff distance. The Hausdorff distance replaces each sum by a maximum and uses plain distances: . It is a metric on finite sets. Each term of is at most its square, so , and the mean form with plain distances is at most . One far outlier sets the Hausdorff distance, but it is only one term in the chamfer sum.
- Earth mover's distance. For two sets of the same size, it is the smallest mean distance over all one-to-one matches, an assignment problem. It sees densities, but it costs much more to compute.
- Registration costs. The cost that ICP lowers at each step is the one-sided chamfer distance from the moved source to the target, and some non-rigid registration methods use the two-sided form as their data term.
References
- Haoqiang Fan, Hao Su and Leonidas Guibas, A point set generation network for 3D object reconstruction from a single image, Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2017), Section 4.3, the Chamfer distance as the sum, in both directions, of the squared distance from each point to its nearest neighbour in the other set, used as a loss beside the earth mover's distance
- H. G. Barrow, J. M. Tenenbaum, R. C. Bolles and H. C. Wolf, Parametric correspondence and chamfer matching: two new techniques for image matching, Proceedings of the 5th International Joint Conference on Artificial Intelligence (IJCAI 1977), 659-663, Chamfer matching: an edge template is scored by the values of a distance transform of the image edges under its points
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag J3N3YK Edit this page History Report an error Markdown