feat: frameset_seq in /api/capture and /ws, added field
The number of the camera frameset an aligned frame comes from, in the same numbering as /api/raw/latest and /api/color/latest: it lets a tool compare Intel's align on PC2 with an align on the host on the SAME frameset. Existing fields unchanged (frame_id still counts responses); the field-set tests now say "the R01 fields plus frameset_seq only". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22815e9b0f
commit
e11565de04
3 files changed
+11
-5
No files matched your search
@@ -245,10 +245,12 @@ def _next_frame_id() -> int:
|
||||
|
||||
|
||||
def _frame_to_dict(frame: CameraFrame, include_images: bool = True) -> dict:
|
||||
"""/api/capture and /ws JSON of a frame. frame_id counts responses, as before."""
|
||||
"""/api/capture and /ws JSON of a frame. frame_id counts responses, as before;
|
||||
frameset_seq (added field) numbers the camera frameset, as /api/raw/latest does."""
|
||||
enc = encoded(frame)
|
||||
result = {
|
||||
"frame_id": _next_frame_id(),
|
||||
"frameset_seq": frame.frameset_seq,
|
||||
"timestamp": frame.timestamp,
|
||||
"rgb_shape": list(frame.rgb.shape),
|
||||
"depth_shape": list(frame.depth.shape),
|
||||
|
||||
@@ -46,6 +46,7 @@ class CameraFrame:
|
||||
rgb: np.ndarray # (H, W, 3) uint8 BGR
|
||||
depth: np.ndarray # (H, W) uint16 millimeters
|
||||
timestamp: float
|
||||
frameset_seq: int = 0 # number of the frameset it was aligned from (as /api/raw/latest); 0 = unknown
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -548,7 +549,8 @@ class RealSenseD435:
|
||||
# Own copies: frames live on after the align (latest frame, 100 ms cache,
|
||||
# shared encodings), and views would keep the SDK's frame pool busy.
|
||||
with timer.phase("copy"):
|
||||
return CameraFrame(rgb=_owned(frame.rgb), depth=_owned(frame.depth), timestamp=frame.timestamp)
|
||||
return CameraFrame(rgb=_owned(frame.rgb), depth=_owned(frame.depth), timestamp=frame.timestamp,
|
||||
frameset_seq=seq)
|
||||
|
||||
def _color_bgr(self, color_frame) -> np.ndarray:
|
||||
"""BGR image of an SDK color frame (YUYV decoded on USB 2; else a view on the SDK buffer)."""
|
||||
|
||||
Reference in new issue
Block a user