TypeSafe.BoxAnswer (typesafe_ex v0.2.1)

Copy Markdown View Source

The answer to a TypeSafe.Box: where something is in an image.

The edges are fractions from 0 to 1, measured from the image's top-left corner: left and right of its width, top and bottom of its height. Use pixels/3 to scale them to an image of known size.

  • confidence - how sure the model is, from 0 to 1, or nil when it doesn't say

There is no "not found" answer: a target that isn't there still gets a box, with low confidence. Ask a TypeSafe.noul/2 about presence in the same call and ignore the box when that comes back low.

Summary

Functions

The box in pixels for an image width by height, as {left, top, right, bottom}.

Types

t()

@type t() :: %TypeSafe.BoxAnswer{
  bottom: float(),
  confidence: float() | nil,
  left: float(),
  right: float(),
  top: float()
}

Functions

pixels(box, width, height)

@spec pixels(t(), pos_integer(), pos_integer()) ::
  {float(), float(), float(), float()}

The box in pixels for an image width by height, as {left, top, right, bottom}.