本文整理汇总了Python中helper.Helper.distanceAtBestAngle方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.distanceAtBestAngle方法的具体用法?Python Helper.distanceAtBestAngle怎么用?Python Helper.distanceAtBestAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper.Helper
的用法示例。
在下文中一共展示了Helper.distanceAtBestAngle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recognize
# 需要导入模块: from helper import Helper [as 别名]
# 或者: from helper.Helper import distanceAtBestAngle [as 别名]
def recognize(self, traces):
#security verification
for trace in traces:
if len(trace) < 2:
return (None, 0) #return none gesture
#information about the gesture
numTracesGesture = len(traces)
pointsGesture = Helper.normalizeGesture(traces)
#comparison process
bestDistance = float('infinity')
bestTemplate = None
for template in self.templates:
distance = Helper.distanceAtBestAngle(pointsGesture, numTracesGesture, template, -angleRange, +angleRange, anglePrecision)
if distance < bestDistance:
bestDistance = distance
bestTemplate = template
score = 1.0 - (bestDistance / halfDiagonal)
#get the best template
if bestTemplate == None:
return(None, 0)
else:
return (bestTemplate.name, score)