Struct VideoFrame#

Struct Documentation#

struct VideoFrame#

An immutable snapshot of one camera grab.

Use std::shared_ptr<VideoFrame> (or std::shared_ptr<const VideoFrame>) to move frames across the grabber → ring-buffer → encoder pipeline without copying the pixel data.

Pixel format: BGR8 — 3 bytes per pixel in Blue, Green, Red order. This is the native Pylon output format and is also what OpenCV and most FFmpeg encoders expect after a sws_scale() call.

Field

Clock

Use case

elapsedNs

steady_clock (host)

Cross-camera alignment (SyncManifest)

wallClockNs

system_clock (host)

Absolute calendar alignment; file naming

hwTimestampNs

camera device clock

Diagnostic ground-truth; per-camera only

Timestamp fields

Three timestamps are captured at (or derived from) the moment of the camera grab (inside VideoGrabber, before the ring-buffer push):

hwTimestampNs comes from the Basler camera’s own GevTimestamp chunk (converted from ticks to nanoseconds using GevTimestampTickFrequency) — it is captured by the camera at exposure time rather than stamped in software after RetrieveResult() returns, so it is not subject to host scheduling/network jitter. However each camera’s device clock is free- running relative to the others unless hardware triggering is active, so it is not directly comparable across cameras and must not be used for cross-camera alignment on its own — use elapsedNs for that. It is 0 if chunk timestamps could not be read from this frame.

All three are written to timestamps_camN.csv by FrameTimestampWriter.

Public Functions

inline bool is_valid() const noexcept#
Returns:

true if the frame has non-zero dimensions and non-empty data.

inline size_t byte_count() const noexcept#
Returns:

Total number of bytes in the pixel data (stride × height).

Public Members

int cameraIndex = 0#

Zero-based camera index (matches timestamps_camN.csv).

int64_t frameId = 0#

Monotonic per-camera counter starting at 1 per session.

int64_t elapsedNs = 0#

elapsed_ns() at grab time — steady_clock.

int64_t wallClockNs = 0#

wall_clock_ns() at grab time — system_clock.

int64_t hwTimestampNs = 0#

Camera-hardware chunk timestamp, ns. 0 if unavailable.

int width = 0#

Frame width in pixels.

int height = 0#

Frame height in pixels.

int stride = 0#

Bytes per row (width × 3 for BGR8, may include padding).

std::vector<uint8_t> data#

Raw pixel bytes in BGR8 order (3 bytes per pixel, row-major).