Spaces:
Running
Running
Irpan
commited on
Commit
•
1d4ab82
1
Parent(s):
0fe1b49
ia
Browse files
speed_and_distance_estimator/speed_and_distance_estimator.py
CHANGED
@@ -30,7 +30,10 @@ class SpeedAndDistance_Estimator():
|
|
30 |
|
31 |
distance_covered = measure_distance(start_position,end_position)
|
32 |
time_elapsed = (last_frame-frame_num)/self.frame_rate
|
33 |
-
|
|
|
|
|
|
|
34 |
speed_km_per_hour = speed_meteres_per_second*3.6
|
35 |
|
36 |
if object not in total_distance:
|
|
|
30 |
|
31 |
distance_covered = measure_distance(start_position,end_position)
|
32 |
time_elapsed = (last_frame-frame_num)/self.frame_rate
|
33 |
+
if time_elapsed == 0:
|
34 |
+
speed_meteres_per_second = 0
|
35 |
+
else:
|
36 |
+
speed_meteres_per_second = distance_covered/time_elapsed
|
37 |
speed_km_per_hour = speed_meteres_per_second*3.6
|
38 |
|
39 |
if object not in total_distance:
|