The chamfer matching algorithm basically calculates the distance (inconsistency) between two images. The basic idea is as follows:
- Extract the edge / contours of the query image as well as the target image.
- Take one point / pixel of the path in the query image and find the distance of the nearest point / pixel of the path in the target image.
- Sum the distances for all edge points / pixels of the query image.
This gives the chamfer distance, that is, the value of the dissonance between the two images. The lower the value, the better the result. However, you should take care of scaling and sliding windows if the target image is larger than the request image, which often happens.
You can find a working example for opencv \ modules \ contrib.
Rudi
source share