mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-02 09:02:15 +03:00
Optionally show tracked object paths in debug view (#19025)
This commit is contained in:
committed by
Blake Blackshear
parent
3609b41217
commit
22478df4d6
@@ -228,6 +228,45 @@ class CameraState:
|
||||
position=self.camera_config.timestamp_style.position,
|
||||
)
|
||||
|
||||
if draw_options.get("paths"):
|
||||
for obj in tracked_objects.values():
|
||||
if obj["frame_time"] == frame_time and obj["path_data"]:
|
||||
color = self.config.model.colormap.get(
|
||||
obj["label"], (255, 255, 255)
|
||||
)
|
||||
|
||||
path_points = [
|
||||
(
|
||||
int(point[0][0] * self.camera_config.detect.width),
|
||||
int(point[0][1] * self.camera_config.detect.height),
|
||||
)
|
||||
for point in obj["path_data"]
|
||||
]
|
||||
|
||||
for point in path_points:
|
||||
cv2.circle(frame_copy, point, 5, color, -1)
|
||||
|
||||
for i in range(1, len(path_points)):
|
||||
cv2.line(
|
||||
frame_copy,
|
||||
path_points[i - 1],
|
||||
path_points[i],
|
||||
color,
|
||||
2,
|
||||
)
|
||||
|
||||
bottom_center = (
|
||||
int((obj["box"][0] + obj["box"][2]) / 2),
|
||||
int(obj["box"][3]),
|
||||
)
|
||||
cv2.line(
|
||||
frame_copy,
|
||||
path_points[-1],
|
||||
bottom_center,
|
||||
color,
|
||||
2,
|
||||
)
|
||||
|
||||
return frame_copy
|
||||
|
||||
def finished(self, obj_id):
|
||||
|
||||
Reference in New Issue
Block a user