tracking_tools/speed.py
2021-01-21 08:36:35 +01:00

29 lines
725 B
Python

import sys
import tracking_result as tr
import numpy as np
import matplotlib.pyplot as plt
from IPython import embed
#tracking_tools]$ python3 speed.py /mnt/movies/merle_verena/boldness/labeled_videos/day_1/2020.12.01_lepto03DLC_resnet50_boldnessDec11shuffle1_200000.h5
if __name__ == '__main__' :
dlc_results = sys.argv[1]
trs = tr.TrackingResult(dlc_results)
t, x, y, l, name = trs.position_values(bodypart="snout", framerate=30)
t = t[l > 0.975]
x = x[l > 0.975]
y = y[l > 0.975]
# Dann Differenzen berechnen
dx= np.diff(x)
dy= np.diff(y)
dt= np.diff(t)
s = np.sqrt(dx**2 + dy**2)
v = s/dt
embed ()
plt.scatter(x[:-1],y[:-1],c=v)
plt.show()