[Math] Similarity metric between two sets of points with varying densities

geometrymachine learning

How can I create a similarity metric that describes the top left set of points as more similar to the bottom left set of points than the top right set of points? Clearly least-squares distance doesn't work.

UPDATE
Hausdorff distance looks good. Now here's a more difficult problem:

Lets say the images (the sets of points) may be rotated, translated, and scaled differently from one another. I want to use the Procrustes algorithm to recover the relative rotation, translation, and scaling, but the Procrustes algorithm is a minimization problem over vectors that contain equal numbers of points. When the densities of the points vary between images, points between images don't correspond well. How can I normalize the input to the Procrustes algorithm to make my image comparison algorithm invariant to varying point densities?

image

To be more concrete, below are some of the images I would like to compare. I don't want the matcher to be thrown off by borders that are thicker relative to the details inside the borders.

enter image description here

Best Answer

Suggestion:

Use the binarized outlines, apply thinning and vectorization (Douglas-Peucker); if possible, decompose in a sequence of line segments and circular arcs (this is uneasy).

(Actually, you are pretty lucky to have those well contrasted outlines, you should exploit them.)

This will allow two things:

  • perform a preliminary classification by outline shape;

  • register the image based on the outline center and orientation (except for the circular pills).

After registration and selection of relevant templates, point-wise similarity metrics can be used (SAD, SSD, NGC...), but unbinarized images are required.

Alternatively, interest point descriptors could do.

Related Question