|
@@ -1263,25 +1263,28 @@ class AsyncCoordinator(Coordinator):
|
|
|
|
|
|
|
|
def _save_ptz_image_for_person_batch(self, batch_id: str, person_index: int,
|
|
def _save_ptz_image_for_person_batch(self, batch_id: str, person_index: int,
|
|
|
ptz_frame: np.ndarray,
|
|
ptz_frame: np.ndarray,
|
|
|
- ptz_position: Tuple[float, float, int]):
|
|
|
|
|
|
|
+ ptz_position: Tuple[float, float, int],
|
|
|
|
|
+ ptz_frame_marked: np.ndarray = None):
|
|
|
"""
|
|
"""
|
|
|
保存球机聚焦图片到指定批次(直接使用 batch_id,不依赖当前批次)
|
|
保存球机聚焦图片到指定批次(直接使用 batch_id,不依赖当前批次)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Args:
|
|
Args:
|
|
|
batch_id: 批次ID
|
|
batch_id: 批次ID
|
|
|
person_index: 人员序号
|
|
person_index: 人员序号
|
|
|
- ptz_frame: 球机帧
|
|
|
|
|
|
|
+ ptz_frame: 球机原始帧
|
|
|
ptz_position: PTZ位置 (pan, tilt, zoom)
|
|
ptz_position: PTZ位置 (pan, tilt, zoom)
|
|
|
|
|
+ ptz_frame_marked: 球机标记帧(可选,不传则在内部标记)
|
|
|
"""
|
|
"""
|
|
|
if self._paired_saver is None:
|
|
if self._paired_saver is None:
|
|
|
return
|
|
return
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
self._paired_saver.save_ptz_image(
|
|
self._paired_saver.save_ptz_image(
|
|
|
batch_id=batch_id,
|
|
batch_id=batch_id,
|
|
|
person_index=person_index,
|
|
person_index=person_index,
|
|
|
ptz_frame=ptz_frame,
|
|
ptz_frame=ptz_frame,
|
|
|
ptz_position=ptz_position,
|
|
ptz_position=ptz_position,
|
|
|
- ptz_bbox=getattr(self, '_last_ptz_bbox', None)
|
|
|
|
|
|
|
+ ptz_bbox=getattr(self, '_last_ptz_bbox', None),
|
|
|
|
|
+ ptz_frame_marked=ptz_frame_marked
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
def _ptz_worker(self):
|
|
def _ptz_worker(self):
|
|
@@ -1467,9 +1470,10 @@ class AsyncCoordinator(Coordinator):
|
|
|
|
|
|
|
|
# 保存球机图片到配对批次(使用命令中的 batch_id 和 person_index)
|
|
# 保存球机图片到配对批次(使用命令中的 batch_id 和 person_index)
|
|
|
if self._enable_paired_saving and batch_id is not None and person_index >= 0 and ptz_frame is not None:
|
|
if self._enable_paired_saving and batch_id is not None and person_index >= 0 and ptz_frame is not None:
|
|
|
- # 使用球机端检测器检测人体并标记
|
|
|
|
|
|
|
+ # 使用球机端检测器检测人体并标记(用于标记图)
|
|
|
ptz_frame_marked = self._mark_ptz_frame_with_detection(ptz_frame, person_index=person_index)
|
|
ptz_frame_marked = self._mark_ptz_frame_with_detection(ptz_frame, person_index=person_index)
|
|
|
- self._save_ptz_image_for_person_batch(batch_id, person_index, ptz_frame_marked, (final_pan, final_tilt, final_zoom))
|
|
|
|
|
|
|
+ # 传入原始帧保存为原图,标记帧保存为标记图
|
|
|
|
|
+ self._save_ptz_image_for_person_batch(batch_id, person_index, ptz_frame, (final_pan, final_tilt, final_zoom), ptz_frame_marked=ptz_frame_marked)
|
|
|
elif self._enable_paired_saving:
|
|
elif self._enable_paired_saving:
|
|
|
logger.warning(f"[配对保存] 跳过球机图保存: batch_id={batch_id}, person_index={person_index}, frame={ptz_frame is not None}")
|
|
logger.warning(f"[配对保存] 跳过球机图保存: batch_id={batch_id}, person_index={person_index}, frame={ptz_frame is not None}")
|
|
|
|
|
|
|
@@ -2012,10 +2016,12 @@ class SequentialCoordinator(AsyncCoordinator):
|
|
|
|
|
|
|
|
# 保存球机图片
|
|
# 保存球机图片
|
|
|
if self._enable_paired_saving and batch_id is not None:
|
|
if self._enable_paired_saving and batch_id is not None:
|
|
|
|
|
+ # 使用球机端检测器检测人体并标记(用于标记图)
|
|
|
ptz_frame_marked = self._mark_ptz_frame_with_detection(ptz_frame, person_index=person_index)
|
|
ptz_frame_marked = self._mark_ptz_frame_with_detection(ptz_frame, person_index=person_index)
|
|
|
|
|
+ # 传入原始帧保存为原图,标记帧保存为标记图
|
|
|
self._save_ptz_image_for_person_batch(
|
|
self._save_ptz_image_for_person_batch(
|
|
|
- batch_id, person_index, ptz_frame_marked,
|
|
|
|
|
- (pan, tilt, final_zoom)
|
|
|
|
|
|
|
+ batch_id, person_index, ptz_frame,
|
|
|
|
|
+ (pan, tilt, final_zoom), ptz_frame_marked=ptz_frame_marked
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
# 保存到本地(无论是否启用配对保存)
|
|
# 保存到本地(无论是否启用配对保存)
|