Rerun C++ SDK
|
Archetype: A monochrome or color image. More...
#include <rerun/archetypes/image.hpp>
Public Types | |
using | IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName > |
Indicator component, used to identify the archetype when converting to a list of components. | |
Public Member Functions | |
Image (Collection< uint8_t > bytes, components::ImageFormat format_) | |
Construct an image from bytes and image format. | |
Image (Collection< uint8_t > bytes, WidthHeight resolution, datatypes::PixelFormat pixel_format) | |
Construct an image from resolution, pixel format and bytes. | |
Image (Collection< uint8_t > bytes, WidthHeight resolution, datatypes::ColorModel color_model, datatypes::ChannelDatatype datatype) | |
Construct an image from resolution, color model, channel datatype and bytes. | |
template<typename T > | |
Image (Collection< T > elements, WidthHeight resolution, datatypes::ColorModel color_model) | |
Construct an image from resolution, color model and elements, inferring the channel datatype from the element type. | |
template<typename T > | |
Image (const T *elements, WidthHeight resolution, datatypes::ColorModel color_model) | |
Construct an image from resolution, color model and element pointer, inferring the channel datatype from the element type. | |
Image (Image &&other)=default | |
Image (const Image &other)=default | |
Image & | operator= (const Image &other)=default |
Image & | operator= (Image &&other)=default |
Image | with_buffer (const rerun::components::ImageBuffer &_buffer) && |
The raw image data. | |
Image | with_many_buffer (const Collection< rerun::components::ImageBuffer > &_buffer) && |
This method makes it possible to pack multiple buffer in a single component batch. | |
Image | with_format (const rerun::components::ImageFormat &_format) && |
The format of the image. | |
Image | with_many_format (const Collection< rerun::components::ImageFormat > &_format) && |
This method makes it possible to pack multiple format in a single component batch. | |
Image | with_opacity (const rerun::components::Opacity &_opacity) && |
Opacity of the image, useful for layering several images. | |
Image | with_many_opacity (const Collection< rerun::components::Opacity > &_opacity) && |
This method makes it possible to pack multiple opacity in a single component batch. | |
Image | with_draw_order (const rerun::components::DrawOrder &_draw_order) && |
An optional floating point value that specifies the 2D drawing order. | |
Image | with_many_draw_order (const Collection< rerun::components::DrawOrder > &_draw_order) && |
This method makes it possible to pack multiple draw_order in a single component batch. | |
Collection< ComponentColumn > | columns (const Collection< uint32_t > &lengths_) |
Partitions the component data into multiple sub-batches. | |
Collection< ComponentColumn > | columns () |
Partitions the component data into unit-length sub-batches. | |
Static Public Member Functions | |
static Image | from_greyscale8 (Collection< uint8_t > bytes, WidthHeight resolution) |
Assumes single channel greyscale/luminance with 8-bit per value. | |
static Image | from_rgb24 (Collection< uint8_t > bytes, WidthHeight resolution) |
Assumes RGB, 8-bit per channel, packed as RGBRGBRGB… . | |
static Image | from_rgba32 (Collection< uint8_t > bytes, WidthHeight resolution) |
Assumes RGBA, 8-bit per channel, with separate alpha. | |
static Image | update_fields () |
Update only some specific fields of a Image . | |
static Image | clear_fields () |
Clear all the fields of a Image . | |
Public Attributes | |
std::optional< ComponentBatch > | buffer |
The raw image data. | |
std::optional< ComponentBatch > | format |
The format of the image. | |
std::optional< ComponentBatch > | opacity |
Opacity of the image, useful for layering several images. | |
std::optional< ComponentBatch > | draw_order |
An optional floating point value that specifies the 2D drawing order. | |
Static Public Attributes | |
static constexpr const char | IndicatorComponentName [] = "rerun.components.ImageIndicator" |
static constexpr const char | ArchetypeName [] = "rerun.archetypes.Image" |
The name of the archetype as used in ComponentDescriptor s. | |
static constexpr auto | Descriptor_buffer |
ComponentDescriptor for the buffer field. | |
static constexpr auto | Descriptor_format |
ComponentDescriptor for the format field. | |
static constexpr auto | Descriptor_opacity |
ComponentDescriptor for the opacity field. | |
static constexpr auto | Descriptor_draw_order |
ComponentDescriptor for the draw_order field. | |
Archetype: A monochrome or color image.
See also archetypes::DepthImage
and archetypes::SegmentationImage
.
Rerun also supports compressed images (JPEG, PNG, …), using archetypes::EncodedImage
. For images that refer to video frames see archetypes::VideoFrameReference
. Compressing images or using video data instead can save a lot of bandwidth and memory.
The raw image data is stored as a single buffer of bytes in a components::Blob
. The meaning of these bytes is determined by the components::ImageFormat
which specifies the resolution and the pixel format (e.g. RGB, RGBA, …).
The order of dimensions in the underlying components::Blob
follows the typical row-major, interleaved-pixel image format.
Since the underlying [rerun::components::Blob] uses rerun::Collection
internally, data can be passed in without a copy from raw pointers or by reference from std::vector
/std::array
/c-arrays. If needed, this "borrow-behavior" can be extended by defining your own rerun::CollectionAdapter
.
|
inline |
Construct an image from bytes and image format.
bytes | The raw image data as bytes. If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H * image_format.bytes_per_pixel . |
format_ | How the data should be interpreted. |
|
inline |
Construct an image from resolution, pixel format and bytes.
bytes | The raw image data as bytes. If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H * pixel_format.bytes_per_pixel . |
resolution | The resolution of the image as {width, height}. |
pixel_format | How the data should be interpreted. |
|
inline |
Construct an image from resolution, color model, channel datatype and bytes.
bytes | The raw image data. If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H * datatype.bytes * color_model.num_channels . |
resolution | The resolution of the image as {width, height}. |
color_model | The color model of the pixel data. |
datatype | Datatype of the individual channels of the color model. |
|
inline |
Construct an image from resolution, color model and elements, inferring the channel datatype from the element type.
elements | Pixel data as a rerun::Collection . If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H * color_model.num_channels . |
resolution | The resolution of the image as {width, height}. |
color_model | The color model of the pixel data. Each element in elements is interpreted as a single channel of the color model. |
|
inline |
Construct an image from resolution, color model and element pointer, inferring the channel datatype from the element type.
elements | The raw image data. ⚠️ Does not take ownership of the data, the caller must ensure the data outlives the image. The number of elements is assumed to be W * H * color_model.num_channels . |
resolution | The resolution of the image as {width, height}. |
color_model | The color model of the pixel data. Each element in elements is interpreted as a single channel of the color model. |
|
inlinestatic |
Assumes single channel greyscale/luminance with 8-bit per value.
bytes | Pixel data as a rerun::Collection . If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H . |
resolution | The resolution of the image as {width, height}. |
|
inlinestatic |
Assumes RGB, 8-bit per channel, packed as RGBRGBRGB…
.
bytes | Pixel data as a rerun::Collection . If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H * 3 . |
resolution | The resolution of the image as {width, height}. |
|
inlinestatic |
Assumes RGBA, 8-bit per channel, with separate alpha.
bytes | Pixel data as a rerun::Collection . If the data does not outlive the image, use std::move or create the rerun::Collection explicitly ahead of time with rerun::Collection::take_ownership . The length of the data should be W * H * 4 . |
resolution | The resolution of the image as {width, height}. |
|
inline |
This method makes it possible to pack multiple buffer
in a single component batch.
This only makes sense when used in conjunction with columns
. with_buffer
should be used when logging a single row's worth of data.
|
inline |
This method makes it possible to pack multiple format
in a single component batch.
This only makes sense when used in conjunction with columns
. with_format
should be used when logging a single row's worth of data.
|
inline |
Opacity of the image, useful for layering several images.
Defaults to 1.0 (fully opaque).
|
inline |
This method makes it possible to pack multiple opacity
in a single component batch.
This only makes sense when used in conjunction with columns
. with_opacity
should be used when logging a single row's worth of data.
|
inline |
An optional floating point value that specifies the 2D drawing order.
Objects with higher values are drawn on top of those with lower values.
|
inline |
This method makes it possible to pack multiple draw_order
in a single component batch.
This only makes sense when used in conjunction with columns
. with_draw_order
should be used when logging a single row's worth of data.
Collection< ComponentColumn > rerun::archetypes::Image::columns | ( | const Collection< uint32_t > & | lengths_ | ) |
Partitions the component data into multiple sub-batches.
Specifically, this transforms the existing ComponentBatch
data into ComponentColumn
s instead, via ComponentBatch::partitioned
.
This makes it possible to use RecordingStream::send_columns
to send columnar data directly into Rerun.
The specified lengths
must sum to the total length of the component batch.
Collection< ComponentColumn > rerun::archetypes::Image::columns | ( | ) |
Partitions the component data into unit-length sub-batches.
This is semantically similar to calling columns
with std::vector<uint32_t>(n, 1)
, where n
is automatically guessed.
std::optional<ComponentBatch> rerun::archetypes::Image::opacity |
Opacity of the image, useful for layering several images.
Defaults to 1.0 (fully opaque).
std::optional<ComponentBatch> rerun::archetypes::Image::draw_order |
An optional floating point value that specifies the 2D drawing order.
Objects with higher values are drawn on top of those with lower values.
|
staticconstexpr |
ComponentDescriptor
for the buffer
field.
|
staticconstexpr |
ComponentDescriptor
for the format
field.
|
staticconstexpr |
ComponentDescriptor
for the opacity
field.
|
staticconstexpr |
ComponentDescriptor
for the draw_order
field.