- В кадре находится только верхняя часть тела человека, но он ходит.
- В кадре только нижняя часть тела человека.
- Решение должно быть защищено от окклюзии.
Код: Выделить всё
def distanceCalculate(p1, p2):
"""p1 and p2 in format (x1, y1) and (x2, y2) tuples"""
dis = ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5
return dis
# Calculate distance between ankles (a crude approximation of taking a step)
if distanceCalculate(leftAnkle, rightAnkle) > 100: # Threshold for step detection
if not stepStart:
stepStart = 1
stepCount += 1
# Append to output JSON
output_data["footsteps"].append({
"step": stepCount,
"timestamp": round(current_time, 2)
})
elif stepStart and distanceCalculate(leftAnkle, rightAnkle) < 50:
stepStart = 0 # Reset after a complete step
Любой совет или предложения будут с благодарностью!
Заранее спасибо!
Подробнее здесь: https://stackoverflow.com/questions/790 ... els-and-he