Skip to content

Commit

Permalink
Merge branch 'main' into emilk/arrow-col-descr
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 17, 2025
2 parents 7e73b70 + 4db780c commit 6e2441f
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 81 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/contrib_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ jobs:
no-codegen-changes:
name: Check if running codegen would produce any changes
runs-on: ubuntu-latest-16-cores
# TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so
runs-on: ubuntu-22.04-large
steps:
# Note: We explicitly don't override `ref` here. We need to see if changes would be made
# in a context where we have merged with main. Otherwise we might miss changes such as one
Expand All @@ -92,7 +93,8 @@ jobs:

rs-lints:
name: Rust lints (fmt, check, clippy, tests, doc)
runs-on: ubuntu-latest-16-cores
# TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so
runs-on: ubuntu-22.04-16core
steps:
- uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/reusable_checks_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ jobs:

rs-lints:
name: Rust lints (fmt, check, clippy, tests, doc)
runs-on: ubuntu-latest-16-cores
# TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so
runs-on: ubuntu-22.04-large
steps:
- uses: actions/checkout@v4
with:
Expand Down
6 changes: 5 additions & 1 deletion crates/utils/re_arrow_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ re_log.workspace = true
re_tracing.workspace = true

arrow.workspace = true
arrow2.workspace = true
arrow2 = { workspace = true, features = [
"compute_concatenate",
"compute_filter",
"compute_take",
] }
itertools.workspace = true
2 changes: 1 addition & 1 deletion crates/utils/re_video/src/decode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ pub enum PixelFormat {
Yuv {
layout: YuvPixelLayout,
range: YuvRange,
// TODO(andreas): color primaries should also apply to RGB data,
// TODO(andreas): Color primaries should also apply to RGB data,
// but for now we just always assume RGB to be BT.709 ~= sRGB.
coefficients: YuvMatrixCoefficients,
// Note that we don't handle chroma sample location at all so far.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/concepts/annotation-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Annotation contexts are logged with:
* Python: 🐍[`rr.AnnotationContext`](https://ref.rerun.io/docs/python/stable/common/archetypes/#rerun.archetypes.AnnotationContext)
* Rust: 🦀[`rerun::AnnotationContext`](https://docs.rs/rerun/latest/rerun/archetypes/struct.AnnotationContext.html#)

snippet: tutorials/annotation-context
snippet: tutorials/annotation_context


## Affected entities
Expand Down
12 changes: 6 additions & 6 deletions docs/snippets/INDEX.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 0 additions & 56 deletions docs/snippets/all/tutorials/annotation-context.rs

This file was deleted.

38 changes: 38 additions & 0 deletions docs/snippets/all/tutorials/annotation_context.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <rerun.hpp>

int main() {
const auto rec = rerun::RecordingStream("rerun_example_annotation_context_connections");
rec.spawn().exit_on_failure();

// Annotation context with two classes, using two labeled classes, of which ones defines a
// color.
rec.log_static(
"masks",
rerun::AnnotationContext({
rerun::AnnotationInfo(0, "Background"),
rerun::AnnotationInfo(1, "Person", rerun::Rgba32(255, 0, 0)),
})
);

// Annotation context with simple keypoints & keypoint connections.
std::vector<rerun::AnnotationInfo> keypoint_annotations;
for (uint16_t i = 0; i < 10; ++i) {
keypoint_annotations.push_back(
rerun::AnnotationInfo(i, rerun::Rgba32(0, static_cast<uint8_t>(28 * i), 0))
);
}

std::vector<rerun::KeypointPair> keypoint_connections;
for (uint16_t i = 0; i < 9; ++i) {
keypoint_connections.push_back(rerun::KeypointPair(i, i + 1));
}

rec.log_static(
"detections", // Applies to all entities below "detections".
rerun::AnnotationContext({rerun::ClassDescription(
rerun::AnnotationInfo(0, "Snake"),
keypoint_annotations,
keypoint_connections
)})
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import rerun as rr

rr.init("rerun_example_annotation_context_connections")

# Annotation context with two classes, using two labeled classes, of which ones defines a color.
rr.log(
"masks", # Applies to all entities below "masks".
Expand All @@ -17,7 +19,7 @@
"detections", # Applies to all entities below "detections".
rr.ClassDescription(
info=rr.AnnotationInfo(0, label="Snake"),
keypoint_annotations=[rr.AnnotationInfo(id=i, color=(0, 255 / 9 * i, 0)) for i in range(10)],
keypoint_annotations=[rr.AnnotationInfo(id=i, color=(0, 28 * i, 0)) for i in range(10)],
keypoint_connections=[(i, i + 1) for i in range(9)],
),
static=True,
Expand Down
40 changes: 40 additions & 0 deletions docs/snippets/all/tutorials/annotation_context.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use rerun::{
datatypes::{ClassDescriptionMapElem, KeypointId},
AnnotationContext, AnnotationInfo, ClassDescription, Rgba32,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_connections")
.spawn()?;

// Annotation context with two classes, using two labeled classes, of which ones defines a
// color.
rec.log_static(
"masks", // Applies to all entities below "masks".
&AnnotationContext::new([
ClassDescriptionMapElem::from((0, "Background")),
ClassDescriptionMapElem::from((1, "Person", Rgba32::from_rgb(255, 0, 0))),
]),
)?;

// Annotation context with simple keypoints & keypoint connections.
rec.log_static(
"detections", // Applies to all entities below "detections".
&AnnotationContext::new([ClassDescription {
info: (0, "Snake").into(),
keypoint_annotations: (0..10)
.map(|i| AnnotationInfo {
id: i,
label: None,
color: Some(Rgba32::from_rgb(0, (28 * i) as u8, 0)),
})
.collect(),
keypoint_connections: (0..9)
.map(|i| (KeypointId(i), KeypointId(i + 1)))
.map(Into::into)
.collect(),
}]),
)?;

Ok(())
}
23 changes: 23 additions & 0 deletions docs/snippets/all/tutorials/any_values.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! Log arbitrary data.
use std::sync::Arc;

use rerun::external::arrow;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_any_values").spawn()?;

let confidences = rerun::SerializedComponentBatch::new(
Arc::new(arrow::array::Float64Array::from(vec![1.2, 3.4, 5.6])),
rerun::ComponentDescriptor::new("confidence"),
);

let description = rerun::SerializedComponentBatch::new(
Arc::new(arrow::array::StringArray::from(vec!["Bla bla bla…"])),
rerun::ComponentDescriptor::new("description"),
);

rec.log("any_values", &[confidences, description])?;

Ok(())
}
Loading

0 comments on commit 6e2441f

Please sign in to comment.