DEV Community

Cover image for How to Visualize VRS Files
Rerun
Rerun

Posted on • Edited on

How to Visualize VRS Files

Source Code Explore Other Examples

This C++ example demonstrates how to visualize VRS files with Rerun. VRS is a file format optimized to record & playback streams of sensor data, such as images, audio samples, and any other discrete sensors (IMU, temperature, etc), stored in per-device streams of time-stamped records.

Logging and visualizing with Rerun

The visualizations in this example were created with the following Rerun code:


3D arrows

void IMUPlayer::log_accelerometer(const std::array<float, 3>& accelMSec2) {
    _rec->log(_entity_path + "/accelerometer", rerun::Arrows3D::from_vectors({accelMSec2}));
    // … existing code for scalars …
}
Enter fullscreen mode Exit fullscreen mode

Scalars

void IMUPlayer::log_accelerometer(const std::array<float, 3>& accelMSec2) {
    // … existing code for Arrows3D …
    _rec->log(_entity_path + "/accelerometer/x", rerun::Scalar(accelMSec2[0]));
    _rec->log(_entity_path + "/accelerometer/y", rerun::Scalar(accelMSec2[1]));
    _rec->log(_entity_path + "/accelerometer/z", rerun::Scalar(accelMSec2[2]));
}

void IMUPlayer::log_gyroscope(const std::array<float, 3>& gyroRadSec) {
    _rec->log(_entity_path + "/gyroscope/x", rerun::Scalar(gyroRadSec[0]));
    _rec->log(_entity_path + "/gyroscope/y", rerun::Scalar(gyroRadSec[1]));
    _rec->log(_entity_path + "/gyroscope/z", rerun::Scalar(gyroRadSec[2]));
}

void IMUPlayer::log_magnetometer(const std::array<float, 3>& magTesla) {
    _rec->log(_entity_path + "/magnetometer/x", rerun::Scalar(magTesla[0]));
    _rec->log(_entity_path + "/magnetometer/y", rerun::Scalar(magTesla[1]));
    _rec->log(_entity_path + "/magnetometer/z", rerun::Scalar(magTesla[2]));
}
Enter fullscreen mode Exit fullscreen mode

Images

_rec->log(
    _entity_path,
    rerun::Image({
    frame->getHeight(),
    frame->getWidth(),
    frame->getSpec().getChannelCountPerPixel()},
    frame->getBuffer()
    )
);
Enter fullscreen mode Exit fullscreen mode

Text document

_rec->log_timeless(_entity_path + "/configuration", rerun::TextDocument(layout_str));
Enter fullscreen mode Exit fullscreen mode

Join us on Github

GitHub logo rerun-io / rerun

Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui.

Build time aware visualizations of multimodal data

Use the Rerun SDK (available for C++, Python and Rust) to log data like images, tensors, point clouds, and text. Logs are streamed to the Rerun Viewer for live visualization or to file for later use.

A short taste

import rerun as rr  # pip install rerun-sdk
rr.init("rerun_example_app")

rr.connect()  # Connect to a remote viewer
# rr.spawn()  # Spawn a child process with a viewer and connect
# rr.save("recording.rrd")  # Stream all logs to disk

# Associate subsequent data with 42 on the “frame” timeline
rr.set_time_sequence("frame", 42)

# Log colored 3D points to the entity at `path/to/points`
rr.log("path/to/points", rr.Points3D(positions, colors=colors
Enter fullscreen mode Exit fullscreen mode

Top comments (0)