clean up comments

This commit is contained in:
Gabriel Grant 2025-02-15 21:29:45 -05:00
parent fea64fa93a
commit 8aab12d853
3 changed files with 7 additions and 11 deletions

View File

@ -1,4 +1,4 @@
from typing import Any, Optional, Union
from typing import Any, Optional
from pydantic import Field, field_serializer, validator
@ -12,8 +12,8 @@ class MotionPathConfig(FrigateBaseModel):
max_history: int = Field(
default=10,
title="Number of positions to maintain in motion path history.",
ge=2, # Minimum of 2 positions needed to draw a path
le=100, # Reasonable upper limit
ge=2,
le=100,
)
mask: Optional[Any] = Field(default=None)
raw_mask: Optional[Any] = Field(default=None)

View File

@ -1,6 +1,7 @@
from typing import Dict, List, Tuple
import cv2
import numpy as np
from typing import Dict, List, Tuple
from filterpy.kalman import KalmanFilter
@ -120,7 +121,6 @@ class PathVisualizer:
start_pos = positions[i - 1]
end_pos = positions[i]
# Draw line with anti-aliasing
cv2.line(frame, start_pos, end_pos, color, 2, cv2.LINE_AA)
# Draw predicted path
@ -133,7 +133,6 @@ class PathVisualizer:
start_pos = predictions[i - 1]
end_pos = predictions[i]
# Create overlay for alpha blending
overlay = frame.copy()
cv2.line(overlay, start_pos, end_pos, color, 2, cv2.LINE_AA)
cv2.addWeighted(overlay, alpha, frame, 1 - alpha, 0, frame)

View File

@ -16,15 +16,15 @@ from frigate.comms.dispatcher import Dispatcher
from frigate.comms.events_updater import EventEndSubscriber, EventUpdatePublisher
from frigate.comms.inter_process import InterProcessRequestor
from frigate.config import (
FrigateConfig,
MqttConfig,
CameraMqttConfig,
FrigateConfig,
RecordConfig,
SnapshotsConfig,
ZoomingModeEnum,
)
from frigate.const import CLIPS_DIR, UPDATE_CAMERA_ACTIVITY
from frigate.events.types import EventStateEnum, EventTypeEnum
from frigate.motion.path_visualizer import PathVisualizer
from frigate.ptz.autotrack import PtzAutoTrackerThread
from frigate.track.tracked_object import TrackedObject
from frigate.util.image import (
@ -34,7 +34,6 @@ from frigate.util.image import (
is_better_thumbnail,
is_label_printable,
)
from frigate.motion.path_visualizer import PathVisualizer
logger = logging.getLogger(__name__)
@ -250,10 +249,8 @@ class CameraState:
)
self.path_visualizer.update_position(obj_id, centroid)
# Draw paths
self.path_visualizer.draw_paths(frame_copy, active_objects)
# Cleanup inactive objects
self.path_visualizer.cleanup_inactive(active_objects)
return frame_copy