mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-06 19:25:22 +03:00
use numpy for euclidean distance
This commit is contained in:
parent
c389d832b2
commit
614099c83f
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import math
|
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
@ -656,10 +655,11 @@ class PtzAutoTracker:
|
|||||||
# more often to keep the object in the center. Raising the percentage will cause less
|
# more often to keep the object in the center. Raising the percentage will cause less
|
||||||
# movement and will be more flexible with objects not quite being centered.
|
# movement and will be more flexible with objects not quite being centered.
|
||||||
# TODO: there's probably a better way to approach this
|
# TODO: there's probably a better way to approach this
|
||||||
distance = math.sqrt(
|
distance = np.linalg.norm(
|
||||||
(obj.obj_data["centroid"][0] - camera_config.detect.width / 2) ** 2
|
[
|
||||||
+ (obj.obj_data["centroid"][1] - camera_config.detect.height / 2)
|
obj.obj_data["centroid"][0] - camera_config.detect.width / 2,
|
||||||
** 2
|
obj.obj_data["centroid"][1] - camera_config.detect.height / 2,
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
obj_width = obj.obj_data["box"][2] - obj.obj_data["box"][0]
|
obj_width = obj.obj_data["box"][2] - obj.obj_data["box"][0]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user