-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Environment
Device: OAK-D W
SpectacularAI: 1.49.0
OS: Ubuntu 22.04
Python: 3.10
Problem
sai-cli process always outputs greyscale images for OAK-D W recordings, even though rgb_video.mp4 is always written to the recording folder. There is no supported path to color output for OAK-D W users.
There are two linked issues:
Issue 1: --use_rgb crashes on OAK-D W
Recording with --use_rgb crashes immediately:
sai-cli record oak --resolution=800p --use_rgb --output my_recording
SpectacularAI WARN: Unsupported image format RGB888i
terminate called after throwing an instance of 'std::runtime_error'
what(): SpectacularAI ERROR: Cannot convert image to Spectacular AI format
Aborted (core dumped)
The OAK-D W uses an IMX378 (rolling shutter) RGB sensor which outputs RGB888i (interleaved). The SDK doesn't handle this format. Note: the --use_rgb help text says "(OAK-D S2)", suggesting this was never intended to work on W but there's no documented alternative for OAK-D W users who want color.
Issue 2: sai-cli process doesn't fall back to rgb_video.mp4
process.py selects frames at two points (lines ~390 and ~552):
targetFrame = keyFrame.frameSet.rgbFrame
if not targetFrame: targetFrame = keyFrame.frameSet.primaryFrame
frameSet.rgbFrame is only populated during spectacularAI.Replay when --use_rgb was used during the original recording. Since --use_rgb crashes on OAK-D W, rgbFrame is always None, and process always falls back to the greyscale primaryFrame.
However, rgb_video.mp4 is always written to the recording folder regardless of --use_rgb. The recording folder contains everything needed to sync color frames to keyframes:
rgb_video.mp4 - full 1920×1080 30fps color video
data.jsonl - per-frame timestamps in {"frames": [...], "number": N, "time": T} entries; frame N in data.jsonl corresponds directly to frame N in rgb_video.mp4
calibration.json — RGB intrinsics (focalLengthX/Y, principalPointX/Y, distortionCoefficients) and the rgbToPrimary 4×4 extrinsic transform
Expected Behaviour
sai-cli process should output color 1920×1080 images for OAK-D W recordings by reading from rgb_video.mp4 when frameSet.rgbFrame is None but the video file is present in the recording folder. Frame sync can be done via cameraPose.pose.time → nearest timestamp in data.jsonl → frame index in rgb_video.mp4.
Request
Either:
Add rgb_video.mp4 fallback in process.py when rgbFrame is None but the video exists, or
Fix the RGB888i format error so --use_rgb works on OAK-D W, or
Document a supported path to color output for OAK-D W (the docs currently don't mention this limitation)
Ideally both 1 and 3 - even if --use_rgb is fixed, the rgb_video.mp4 fallback would be more robust since it avoids the VIO overhead of using the rolling-shutter RGB camera for tracking.