ROIを頭部だけに絞ってアップスケールする
This commit is contained in:
1 parent
1aa107106d
commit
c76036cd5c
4 files changed
+19
-3
No files matched your search
@@ -14,10 +14,15 @@ def create_face_roi(person: TrackedPerson, frame_width: int, frame_height: int,
|
||||
candidate_height = bbox.height * config.roi_height_ratio
|
||||
expand_x = bbox.width * config.roi_expand_ratio
|
||||
expand_y = candidate_height * config.roi_expand_ratio
|
||||
x1 = max(0, round(bbox.x1 - expand_x))
|
||||
y1 = max(0, round(bbox.y1 - expand_y))
|
||||
x2 = min(frame_width, round(bbox.x2 + expand_x))
|
||||
y2 = min(frame_height, round(bbox.y1 + candidate_height + expand_y))
|
||||
if config.roi_square:
|
||||
half = (y2 - y1) / 2.0 # 縦幅と同じ幅の正方形
|
||||
x1 = max(0, round(bbox.center_x - half))
|
||||
x2 = min(frame_width, round(bbox.center_x + half))
|
||||
else:
|
||||
x1 = max(0, round(bbox.x1 - expand_x))
|
||||
x2 = min(frame_width, round(bbox.x2 + expand_x))
|
||||
if x2 - x1 < config.min_roi_width or y2 - y1 < config.min_roi_height:
|
||||
return None
|
||||
return FaceROI(person.track_id, x1, y1, x2, y2, bbox, person.confidence)
|
||||
Reference in new issue
Block a user