In computer vision and 3D graphics,
Chamfer distance is a distance function that estimates the similarity between two point clouds.
For two point clouds P={p1,p2,...,pm} and Qโ{q1,q2,...,qn},
the chamfer distance is defined as follows:
Chamfer Distance(P,Q)=โpโPmin
The left term computes the distance from each p to the nearest q.
Specifically, it first finds the minimum distance between p and Q, and then adds it to P.
Since the terms are symmetric, the right term performs the same operation, finding the distance from each q to the nearest p and adding it to Q.
\,\\
\sum_{p \in P} \min_{q \in Q} \|p - q\|^2_2
\,\\
Normalization term can be added when the point clouds have significant differences in size or density.
\,\\
\text{Chamfer Distance}(P, Q) = \frac{1}{|P|}\sum_{p \in P} \min_{q \in Q} \|p - q\|^2_2 \,\, + \frac{1}{|Q|}\sum_{q \in Q} \min_{p \in P} \|q - p\|^2_2
\,\\