Archetype: An image made up of integer class-ids.
The shape of the TensorData
must be mappable to an HxW
tensor. Each pixel corresponds to a class-id that will be mapped to a color based on annotation context.
In the case of floating point images, the label will be looked up based on rounding to the nearest integer value.
Leading and trailing unit-dimensions are ignored, so that 1x640x480x1
is treated as a 640x480
image.
Since the underlying rerun::datatypes::TensorData
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
.
Example
Simple segmentation image
#include <rerun.hpp>
#include <algorithm>
#include <vector>
int main() {
rec.spawn().exit_on_failure();
const int HEIGHT = 8;
const int WIDTH = 12;
std::vector<uint8_t>
data(WIDTH * HEIGHT, 0);
for (auto y = 0; y <4; ++y) {
std::fill_n(
data.begin() + y * WIDTH, 6,
static_cast<uint8_t
>(1));
}
for (auto y = 4; y <8; ++y) {
std::fill_n(
data.begin() + y * WIDTH + 6, 6,
static_cast<uint8_t
>(2));
}
rec.log_timeless(
"/",
})
);
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:57
Archetype: The AnnotationContext provides additional information on how to display entities.
Definition annotation_context.hpp:63
Archetype: An image made up of integer class-ids.
Definition segmentation_image.hpp:73
rerun::components::TensorData data
The image data. Should always be a rank-2 tensor.
Definition segmentation_image.hpp:75
Datatype: Annotation info annotating a class id or key-point id.
Definition annotation_info.hpp:25
Datatype: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition rgba32.hpp:27