6
$\begingroup$

I have two segments in $\mathbb{R}^2$ and I would like to define a measure of similarity between the two segments.

My idea is that I can apply:

  1. a scale transformation $s$ in order to equate the lenghts of the two segments;
  2. a translation $\mathbf{t}$ in order to equate the center points of the two segments;
  3. a 2D rotation of an angle $\alpha$ (described by a rotation matrix $\mathbf{R}$) in order to perfectly overlap the two segments.

and then the similarity measure would be based on

  1. the distance of $s$ from 1;
  2. the magnitude of $t$ (i.e. $\mathbf{t}^T\mathbf{t}$);
  3. the distance between $\alpha$ and 0 (or between $\mathbf{R}$ and the identity matrix $\mathbf{I}$).

but how to combine the above contributes? In a linear way?

Is there any "classic" measure of similarity already defined?

Edit: The two segments are oriented so $AB$ and $BA$ are different.

$\endgroup$
10
  • 3
    $\begingroup$ I would be much easier to compute the Hausdorff distance between the segments. If the vertices are $AB$ and $CD$, the distance is $\min(\max(|AC|,|BD|), \max(|AD|,|BC|))$. $\endgroup$
    – user147263
    Jul 8, 2014 at 20:05
  • 1
    $\begingroup$ what is the distance between $AB$ and $BA$? (it is $0$ for the Hausdorff distance, but, apparently, $\pi$ in your description). $\endgroup$
    – sds
    Jul 8, 2014 at 20:21
  • $\begingroup$ @This: That's a great suggestion, but your formula can't be right. The Hausdorff distance between the two diagonals of a unit square is $1/\sqrt2$ but your formula gives $1$. I'd believe that it's only off by a bounded factor though. $\endgroup$
    – user856
    Jul 8, 2014 at 20:30
  • 1
    $\begingroup$ @Rahul Thanks for noticing. I guess you found the worst case, when the formula is off by the factor of $\sqrt{2}$. uvts_cvs: I second the question by sds: are your line segments oriented? $\endgroup$
    – user147263
    Jul 8, 2014 at 20:43
  • 2
    $\begingroup$ Perhaps try the Fréchet distance, then (which I'm pretty sure is just $\max(|AC|,|BD|)$). $\endgroup$
    – user856
    Jul 9, 2014 at 6:38

3 Answers 3

5
$\begingroup$

One measure that is sometimes used, especially if the lines get more complicated is the (normal or weak) Fréchet distance (also on wiki) that takes into account the ordering of the points to be traversed on the lines. Also you may also find the answer here useful.

$\endgroup$
1
$\begingroup$

This paper describes six different measures, namely:

Hausdorff-distance (HD), Trucco-distance (TD), Modified line segment Hausdorff-distance (MHD), Modified perpendicular line segment Hausdorff-distance (MPHD), Midpoint-distance (MD), Closest point-distance (CD) and our new Straight line-distance function (SD).

WIRTZ, Stefan; PAULUS, Dietrich. Evaluation of established line segment distance functions. Proceedings of the 9th Open German-Russian Workshop on Pattern Recognition and Image Understanding Dec 1-5, 2014, Koblenz, Germany, 89.

$\endgroup$
1
$\begingroup$

I would like to suggest methods in this PPT(https://github.com/yaodi833/traj_similarity): enter image description here

And I find that TRACLUS is good for engineers

Reference: https://github.com/yaodi833/traj_similarity

$\endgroup$
1
  • $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Feb 10, 2022 at 6:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .