rects.py
rerun.log.rects
class RectFormat
Bases: Enum
How to specify rectangles (axis-aligned bounding boxes).
XYWH = 'XYWH'
class-attribute
instance-attribute
[x,y,w,h], with x,y = left,top.
YXHW = 'YXHW'
class-attribute
instance-attribute
[y,x,h,w], with x,y = left,top.
XYXY = 'XYXY'
class-attribute
instance-attribute
[x0, y0, x1, y1], with x0,y0 = left,top and x1,y1 = right,bottom.
YXYX = 'YXYX'
class-attribute
instance-attribute
[y0, x0, y1, x1], with x0,y0 = left,top and x1,y1 = right,bottom.
XCYCWH = 'XCYCWH'
class-attribute
instance-attribute
[x_center, y_center, width, height].
XCYCW2H2 = 'XCYCW2H2'
class-attribute
instance-attribute
[x_center, y_center, width/2, height/2].
def log_rect(entity_path, rect, *, rect_format=RectFormat.XYWH, color=None, label=None, class_id=None, draw_order=None, ext=None, timeless=False, recording=None)
Log a 2D rectangle.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_path |
str
|
Path to the rectangle in the space hierarchy. |
required |
rect |
ArrayLike | None
|
the rectangle in [x, y, w, h], or some format you pick with the |
required |
rect_format |
RectFormat
|
how to interpret the |
XYWH
|
color |
Color | None
|
Optional RGB or RGBA in sRGB gamma-space as either 0-1 floats or 0-255 integers, with separate alpha. |
None
|
label |
str | None
|
Optional text to show inside the rectangle. |
None
|
class_id |
int | None
|
Optional class id for the rectangle. The class id provides color and label if not specified explicitly. See rerun.log_annotation_context |
None
|
draw_order |
float | None
|
An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. The default for rects is 10.0. |
None
|
ext |
dict[str, Any] | None
|
Optional dictionary of extension components. See rerun.log_extension_components |
None
|
timeless |
bool
|
If true, the rect will be timeless (default: False). |
False
|
recording |
RecordingStream | None
|
Specifies the |
None
|
def log_rects(entity_path, rects, *, rect_format=RectFormat.XYWH, identifiers=None, colors=None, labels=None, class_ids=None, draw_order=None, ext=None, timeless=False, recording=None)
Log multiple 2D rectangles.
Logging again to the same entity_path
will replace all the previous rectangles.
Colors should either be in 0-255 gamma space or in 0-1 linear space. Colors can be RGB or RGBA. You can supply no colors, one color, or one color per point in a Nx3 or Nx4 numpy array.
Supported dtype
s for colors
:
- uint8: color components should be in 0-255 sRGB gamma space, except for alpha which should be in 0-255 linear space.
- float32/float64: all color components should be in 0-1 linear space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_path |
str
|
Path to the rectangles in the space hierarchy. |
required |
rects |
ArrayLike | None
|
Nx4 numpy array, where each row is [x, y, w, h], or some format you pick with the |
required |
rect_format |
RectFormat
|
how to interpret the |
XYWH
|
identifiers |
Sequence[int] | None
|
Unique numeric id that shows up when you hover or select the point. |
None
|
colors |
Color | Colors | None
|
Optional per-rectangle gamma-space RGB or RGBA as 0-1 floats or 0-255 integers. |
None
|
labels |
Sequence[str] | None
|
Optional per-rectangle text to show inside the rectangle. |
None
|
class_ids |
OptionalClassIds
|
Optional class ids for the rectangles. The class id provides colors and labels if not specified explicitly. See rerun.log_annotation_context |
None
|
draw_order |
float | None
|
An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. The default for rects is 10.0. |
None
|
ext |
dict[str, Any] | None
|
Optional dictionary of extension components. See rerun.log_extension_components |
None
|
timeless |
bool
|
|
False
|
recording |
RecordingStream | None
|
Specifies the |
None
|