QrScanner.Code (qr_scanner v0.1.0)

Copy Markdown View Source

A decoded QR code.

  • :text - the decoded payload.
  • :corners - [top_left, top_right, bottom_right, bottom_left] as {x, y} pixel coordinates. The order is in the symbol's own frame, so on an upside-down page top_left is near the bottom-right of the image.
  • :angle - direction of the symbol's top edge (top-left → top-right) in degrees, clockwise, in (-180, 180]. 0.0 means upright. Rotate the image by -angle to straighten it exactly.
  • :rotation - :angle snapped to the nearest quarter turn: 0, 90, 180 or 270. The image content is turned this far clockwise; rotate it by -rotation (e.g. magick -rotate -90) to make it upright.
  • :skew - what is left after removing the quarter turn (angle - rotation, normalised to [-45, 45]), i.e. the small tilt of a scan or photo.

Summary

Types

point()

@type point() :: {float(), float()}

t()

@type t() :: %QrScanner.Code{
  angle: float(),
  corners: [point()],
  rotation: 0 | 90 | 180 | 270,
  skew: float(),
  text: String.t()
}