TRUNCATED_WIDTH_RATIOをコンフィグ化してdefault.yamlから変更できるように

This commit is contained in:
agomizi1cm committed 2026-10-01 13:42:02 +09:00
1 parent 31120e4c33
commit 837f969c77
3 files changed
+5 -3

No files matched your search

+1 -3
View File
@@ -3,8 +3,6 @@
from .config_loader import FaceSettings
from .models import FaceROI, TrackedPerson
TRUNCATED_WIDTH_RATIO = 0.45
def create_face_roi(person: TrackedPerson, frame_width: int, frame_height: int, config: FaceSettings) -> FaceROI | None:
"""Create a clipped upper-body ROI or return None when the track is ineligible."""
if config.require_confirmed_track and not person.is_confirmed:
@@ -14,7 +12,7 @@ def create_face_roi(person: TrackedPerson, frame_width: int, frame_height: int,
bbox = person.bbox
candidate_height = bbox.height * config.roi_height_ratio
if bbox.y2 >= frame_height - 2:
candidate_height = max(candidate_height, bbox.width * TRUNCATED_WIDTH_RATIO)
candidate_height = max(candidate_height, bbox.width * config.roi_truncated_width_ratio)
expand_x = bbox.width * config.roi_expand_ratio
expand_y = candidate_height * config.roi_expand_ratio
y1 = max(0, round(bbox.y1 - expand_y))