Examples
In the Rerun GitHub repository we maintain a list of examples that demonstrate using the Rerun logging APIs. Generally the examples are individually self-contained, and can be run directly from a Git clone of the repository. Many of the Python examples need additional dependencies set up in a requirements.txt
next to the example. These are noted in the individual example sections below.
Setup
Make sure you have the Rerun repository checked out and the latest SDK installed.
pip install --upgrade rerun-sdk # install the latest Rerun SDK git clone git@github.com:rerun-io/rerun.git # Clone the repository cd rerun git checkout latest # Check out the commit matching the latest SDK release
Note: Make sure your SDK version matches the examples. For example, if your SDK version is
0.3.1
, check out the matching tag in the Rerun repository by runninggit checkout v0.3.1
.
Minimal example
The simplest example of how to use Rerun, showing how to log a point cloud.
python examples/python/minimal/main.py
Examples with Real Data
The following examples illustrate using the Rerun logging SDK with potential real-world (if toy) use cases. They all require additional data to be downloaded, so an internet connection is needed at least once. The dataset fetching logic is all built into the examples, so no additional steps are needed. In some of the examples such as Stable Diffusion, the algorithm is run on-line, and may benefit from a GPU-enabled PyTorch machine.
COLMAP
An example using Rerun to log and visualize the output of COLMAP's sparse reconstruction.
COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface.
In this example a short video clip has been processed offline by the COLMAP pipeline, and we use Rerun to visualize the individual camera frames, estimated camera poses, and resulting point clouds over time.
pip install -r examples/python/colmap/requirements.txt python examples/python/colmap/main.py
Deep SDF
Generate Signed Distance Fields for arbitrary meshes using both traditional methods as well as the one described in the DeepSDF paper, and visualize the results using the Rerun SDK.
pip install -r examples/python/deep_sdf/requirements.txt python examples/python/deep_sdf/main.py
Dicom
Example using a DICOM MRI scan. This demonstrates the flexible tensor slicing capabilities of the Rerun viewer.
pip install -r examples/python/dicom/requirements.txt python examples/python/dicom/main.py
MP Pose
Use the MediaPipe Pose solution to detect and track a human pose in video.
pip install -r examples/python/mp_pose/requirements.txt python examples/python/mp_pose/main.py
NYUD
Example using an example dataset from New York University with RGB and Depth channels.
pip install -r examples/python/nyud/requirements.txt python examples/python/nyud/main.py
Objectron
Example of using the Rerun SDK to log the Objectron dataset.
The Objectron dataset is a collection of short, object-centric video clips, which are accompanied by AR session metadata that includes camera poses, sparse point-clouds and characterization of the planar surfaces in the surrounding environment.
pip install -r examples/python/objectron/requirements.txt python examples/python/objectron/main.py
Raw Mesh
This example demonstrates how to use the Rerun SDK to log raw 3D meshes (so-called "triangle soups") and their transform hierarchy. Simple material properties are supported.
pip install -r examples/python/raw_mesh/requirements.txt python examples/python/raw_mesh/main.py
Stable Diffusion
A more elaborate example running Depth Guided Stable Diffusion 2.0.
For more info see here.
pip install -r examples/python/stable_diffusion/requirements.txt python examples/python/stable_diffusion/main.py
Tracking HF OpenCV
Another more elaborate example applying simple object detection and segmentation on a video using the Huggingface transformers
library. Tracking across frames is performed using CSRT from OpenCV.
For more info see: https://huggingface.co/docs/transformers/index
pip install -r examples/python/tracking_hf_opencv/requirements.txt python examples/python/tracking_hf_opencv/main.py
Examples with Artificial Data
The following examples serve to illustrate various uses of the Rerun logging SDK. They should not require any additional data downloads, and should run offline.
API Demo
This is a swiss-army-knife example showing the usage of most of the Rerun SDK APIs. The data logged is static and meaningless.
Multiple sub-examples are available (See the instructions by running with the --help
flag).
python examples/python/api_demo/main.py
Car
A very simple 2D car is drawn using OpenCV, and a depth image is simulated and logged as a point cloud.
pip install -r examples/python/car/requirements.txt python examples/python/car/main.py
Clock
An example visualizing an analog clock with hour, minute and seconds hands using Rerun Arrow3D primitives.
python examples/python/clock/main.py
Multiprocessing
Demonstrates how rerun can work with the python multiprocessing
library.
python examples/python/multiprocessing/main.py
Multithreading
Demonstration of logging to Rerun from multiple threads.
python examples/python/multithreading/main.py
Plots
This example demonstrates how to log simple plots with the Rerun SDK. Charts can be created from 1-dimensional tensors, or from time-varying scalars.
python examples/python/plots/main.py
Text Logging
This example demonstrates how to integrate python's native logging
with the Rerun SDK.
Rerun is able to act as a Python logging handler, and can show all your Python log messages in the viewer next to your other data.
python examples/python/text_logging/main.py