optris::sdk::BgraFrame
BGRA8 false-color visualization frame.
Pixel layout is B-G-R-A: byte 0 is blue, byte 1 green, byte 2 red, byte 3 alpha, which is always 0xFF. That is what Windows bitmaps, Avalonia's Bgra8888, SDL's ARGB8888 and most GPU texture uploads want, so the common cases are a straight memcpy with no channel work at all.
This class was called RgbaFrame until v12. It never carried RGBA and its documentation always said so, but the name said otherwise, and a name is what a caller reads first. Somebody who trusted it would swap red and blue in every picture -- which does not look like a byte-order mistake, it looks like a broken camera. Nothing had shipped, so the name was corrected rather than explained; the bytes are unchanged.
Measured, not asserted: PipelineBackendsTest. ByteZeroOfTheColorizedFrameIsBlue supplies a palette through Rgb24, whose channels are named, and checks where each one comes out. It runs against both the CPU and the GPU backend, and they agree.
Public functions
BgraFrame
BgraFrame()=default
BgraFrame
BgraFrame(uint32_t width, uint32_t height)
GetWidth
auto GetWidth() const -> uint32_t
GetHeight
auto GetHeight() const -> uint32_t
GetStride
auto GetStride() const -> uint32_t
Row stride in bytes (width * 4, no padding).
GetData
auto GetData() const -> const uint8_t *
BGRA8 pixel buffer in row-major order.
GetMutableData
auto GetMutableData() -> uint8_t *
Writable pixel buffer for the colorizer to fill.
GetDataSize
auto GetDataSize() const -> size_t
Size in bytes (width * height * 4).
GetMetadata
auto GetMetadata() const -> const FrameMetadata &
The capture this picture was drawn from: its sequence number, its time stamp, the shutter state, the probe temperatures and the two reliability flags -- the same record ThermalFrame carries.
Read HasMetadata() first. A picture nobody marked carries a default-constructed record, and sequence defaults to 0, which is a real frame: the first one of the stream. So there is no value here that can mean "nobody said".
Why this is here at all: a colour image said nothing about the frame it was drawn from, so an application showing the picture beside the frame's own facts -- the recording time of a replayed frame, the flag state, the sequence -- had to pair it with the newest thermal frame it happened to hold. The two paths arrive independently, so that pairing is one frame late while a stream runs and can be far wrong once: a paused replay seeking to a new position delivers one frame, the picture arrives first, and the pairing then stays wrong until playback resumes.
RawFrame and EnergyFrame carry it from the same assignment at the same delivery site, so all the views of one capture take their identity from one place.
HasMetadata
auto HasMetadata() const -> bool
Whether the SDK marked this picture with the capture above.
False on a picture built by hand, and on any delivery path that has no thermal frame behind it. Never false on a frame handed to Imager::SetBgraCallback(), FrameSource::SetBgraCallback() or the C BGRA callback -- the tests assert that rather than the documentation claiming it.
SetMetadata
auto SetMetadata(const FrameMetadata &metadata) -> void
Mark this picture as drawn from metadata's capture.
Called once per delivery, at the point the picture is handed out, so the mark cannot describe a frame that has moved on.
Resize
auto Resize(uint32_t width, uint32_t height) -> void
Reallocates the internal buffer; invalidates all pointers.
Leaves the metadata alone: a resize is about the buffer, and a caller that resizes before filling a picture then marks it.