BB.Camera.Annotation.Layer (bb_camera v0.3.0)

Copy Markdown View Source

What a viewer draws over a camera's video for one message.

Every coordinate in primitives is in pixels of a frame width by height, the frame the message describes - not the size the video happens to be displayed at, which the viewer scales to. Primitives are drawn in order, so a later one is on top of an earlier one.

lifetime is how long the layer stays up with nothing newer to replace it, counted from the message's capture time, or :infinity to stay until replaced. A layer with no primitives clears what was there. See BB.Camera.Annotation for how a viewer treats a layer.

The primitives follow Foxglove's ImageAnnotations: BB.Camera.Annotation.Points, BB.Camera.Annotation.Circle and BB.Camera.Annotation.Text. Foxglove keeps them in a list per kind and draws the kinds in a fixed order; one list here lets the implementation choose what goes on top.

Summary

Functions

Build a layer.

Like new/1, but raises.

Types

primitive()

t()

@type t() :: %BB.Camera.Annotation.Layer{
  height: pos_integer(),
  lifetime: Localize.Unit.t() | :infinity,
  primitives: [primitive()],
  width: pos_integer()
}

Functions

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, term()}

Build a layer.

new!(opts)

@spec new!(keyword()) :: t()

Like new/1, but raises.