optris_sdk_image
A borrowed view of one image frame.
The RGBA, RGB, raw and energy callbacks all deliver this: they differ only in what a pixel means, which format says. The thermal frame is not one of these -- it has metadata and a temperature scale, and keeps its own handle type.
Public attributes
struct_size
uint32_t struct_size
Set to sizeof(optris_sdk_image).
format
optris_sdk_pixel_format format
What the bytes mean.
data
const void * data
Borrowed: valid only until the callback returns. Copy it to keep it.
size_bytes
size_t size_bytes
How many bytes data points at.
width
uint32_t width
The picture's width in pixels, which is not always the sensor's.
The RGBA and RGB callbacks deliver the frame as placed on the canvas, so a camera positioned on a larger canvas reports the canvas size here rather than its own. The raw and energy callbacks are always sensor-native, and so are external buffers, whose size is agreed against the sensor frame.
height
uint32_t height
Height in pixels, with the same caveat as width. Rows run top-left first; there is no bottom-up variant of any of these buffers.
Read both fields on every frame rather than caching what the first one said. A change of operation mode resizes the sensor frame mid-stream, and a canvas placement resizes the colorized one, neither of which stops the callbacks to tell you.
stride_bytes
uint32_t stride_bytes
Bytes from the start of one row to the start of the next. Equal to width * bytes_per_pixel for every frame this SDK produces, but read it rather than assuming so.
bytes_per_pixel
uint32_t bytes_per_pixel
How many bytes one pixel occupies. Fixed by format: 2 for OPTRIS_SDK_PIXEL_RAW16, 3 for OPTRIS_SDK_PIXEL_RGB8, 4 for both OPTRIS_SDK_PIXEL_BGRA8 and OPTRIS_SDK_PIXEL_ENERGY32.
Those last two are why a reader must branch on format and not on this: it says how far apart the pixels are, not what a pixel means. Four bytes here is a colour in one case and a signed radiometric sample in the other.
has_frame_metadata
int32_t has_frame_metadata
Non-zero when frame_sequence and frame_timestamp_us below describe the capture this frame was drawn from.
Check this before reading either of them. Zero is a real sequence number -- the first frame of the stream -- and a real time stamp, so neither field has a value that can mean "nobody said". Zero here means exactly that, and the two fields are zero.
Non-zero on every frame of the BGRA, RGB, raw and energy callbacks of a camera, a replay and a reopened still. Zero on a replay of a picture-only file -- one written with the palette already in its pixels -- where the decoder has no capture record to report.
Appended after bytes_per_pixel, so a caller compiled against an older header owns a struct that stops there. The SDK sets struct_size to its own sizeof, so compare against it before reading these three: image->struct_size >= offsetof(optris_sdk_image, frame_timestamp_us) + sizeof(uint64_t). Nothing about the fields above this line moved.
frame_sequence
uint32_t frame_sequence
The capture's monotonic sequence number, the same value optris_sdk_frame_info::sequence carries for the thermal frame of the same moment.
This is what makes a picture pairable with its measurement. The two arrive by independent paths -- the image callback runs on the SDK's thread and the thermal frame is read by the application -- so pairing on "the newest thermal frame I hold" is one frame late while a stream runs, and stays wrong indefinitely after a paused replay's single seeked frame.
Meaningless unless has_frame_metadata is non-zero.
frame_timestamp_us
uint64_t frame_timestamp_us
When the capture was taken, in microseconds, the same value optris_sdk_frame_info::timestamp_us carries.
A stopwatch reading, not a date -- see that field for what the epoch is and is not. Meaningless unless has_frame_metadata is non-zero.