接入 Autocal 实时相机及帧时间显示
视频和相机共用 Finger worker,并保留采集时间、源帧编号及媒体时间。通过界面、采集链和真实视频验证。
This commit is contained in:
@@ -176,6 +176,7 @@ class _Runtime:
|
||||
"""A stand-in for ``FingerRuntime`` with the API the worker uses."""
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
self._source_seq = 0
|
||||
self.tactile = types.SimpleNamespace(
|
||||
raw_sensor=_Sensor(),
|
||||
reset=lambda: None,
|
||||
@@ -192,6 +193,16 @@ class _Runtime:
|
||||
def read_source(self):
|
||||
return True, np.zeros((8, 8, 3), dtype=np.uint8)
|
||||
|
||||
def read_source_stamped(self):
|
||||
self._source_seq += 1
|
||||
return types.SimpleNamespace(
|
||||
image=np.zeros((8, 8, 3), dtype=np.uint8),
|
||||
sequence=self._source_seq,
|
||||
host_mono_ns=time.perf_counter_ns(),
|
||||
host_utc_ns=time.time_ns(),
|
||||
media_time_ms=self._source_seq * 50.0,
|
||||
)
|
||||
|
||||
def process_frame(self, frame, *, color=False):
|
||||
return np.zeros((8, 8), dtype=np.uint8)
|
||||
|
||||
@@ -276,6 +287,14 @@ def test_finger_video_and_camera_use_the_same_packet_path(source, monkeypatch):
|
||||
assert packet.processed_frame.shape == (8, 8, 3)
|
||||
assert packet.session_id == 1
|
||||
assert packet.frame_id == 0
|
||||
assert packet.source_frame_id == 1
|
||||
assert packet.capture_mono_ns is not None
|
||||
assert packet.capture_utc_ns is not None
|
||||
assert packet.timestamp == pytest.approx(packet.capture_utc_ns / 1e9)
|
||||
assert packet.time_basis == (
|
||||
"host_replay" if isinstance(source, str) else "host_camera"
|
||||
)
|
||||
assert packet.media_time_ms == 50.0
|
||||
finally:
|
||||
worker.stop(wait=True)
|
||||
_restore(saved)
|
||||
|
||||
Reference in New Issue
Block a user