mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-07 03:35:26 +03:00
fix velocity bug
This commit is contained in:
parent
2722fe18b6
commit
419d5006c6
@ -524,16 +524,16 @@ class PtzAutoTracker:
|
|||||||
|
|
||||||
def _get_valid_velocity(self, camera, obj):
|
def _get_valid_velocity(self, camera, obj):
|
||||||
# returns a tuple and euclidean distance if the estimated velocity is valid
|
# returns a tuple and euclidean distance if the estimated velocity is valid
|
||||||
# if invalid, returns (0, 0, 0, 0) and -1
|
# if invalid, returns [0, 0] and -1
|
||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
camera_width = camera_config.frame_shape[1]
|
camera_width = camera_config.frame_shape[1]
|
||||||
camera_height = camera_config.frame_shape[0]
|
camera_height = camera_config.frame_shape[0]
|
||||||
camera_fps = camera_config.detect.fps
|
camera_fps = camera_config.detect.fps
|
||||||
|
|
||||||
velocities = obj.obj_data["estimate_velocity"]
|
velocities = obj.obj_data["estimate_velocity"]
|
||||||
|
diff = np.abs(velocities[1] - velocities[0])
|
||||||
|
|
||||||
vel_mags = np.linalg.norm(np.diff(velocities, axis=0), axis=1)
|
if (diff > 8).any():
|
||||||
if np.any(vel_mags > 8):
|
|
||||||
# invalid velocity
|
# invalid velocity
|
||||||
return np.zeros(2), -1
|
return np.zeros(2), -1
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user