comparison trafficintelligence/moving.py @ 1081:346b41cbc81a

added code idea from Paul St Aubin
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 21 Jul 2018 22:36:47 -0400
parents 845d694af7b8
children 7853106677b7
comparison
equal deleted inserted replaced
1079:845d694af7b8 1081:346b41cbc81a
1867 if d < matchingDistance: 1867 if d < matchingDistance:
1868 return d 1868 return d
1869 else: 1869 else:
1870 return matchingDistance + 1 1870 return matchingDistance + 1
1871 1871
1872 def matchObjects(obj1, obj2, instant, matchingDistance):
1873 '''Indicates if obj matches obj2 with threshold matchingDistance
1874 Returns distance if below matchingDistance, matchingDistance+1 otherwise
1875 (returns an actual value, otherwise munkres does not terminate)'''
1876 d = Point.distanceNorm2(obj1.getPositionAtInstant(instant), obj2.getPositionAtInstant(instant))
1877 if d < matchingDistance:
1878 return d
1879 else:
1880 return matchingDistance + 1
1881
1882 # TODO class to have different matching methods, eg with something like matchObjects
1872 def computeClearMOT(annotations, objects, matchingDistance, firstInstant, lastInstant, returnMatches = False, debug = False): 1883 def computeClearMOT(annotations, objects, matchingDistance, firstInstant, lastInstant, returnMatches = False, debug = False):
1873 '''Computes the CLEAR MOT metrics 1884 '''Computes the CLEAR MOT metrics
1874 1885
1875 Reference: 1886 Reference:
1876 Keni, Bernardin, and Stiefelhagen Rainer. "Evaluating multiple object tracking performance: the CLEAR MOT metrics." EURASIP Journal on Image and Video Processing 2008 (2008) 1887 Keni, Bernardin, and Stiefelhagen Rainer. "Evaluating multiple object tracking performance: the CLEAR MOT metrics." EURASIP Journal on Image and Video Processing 2008 (2008)