drawAnnotationsNormalized static method

void drawAnnotationsNormalized(
  1. Image image,
  2. List<NormalizedVertex> vertices, {
  3. String color = 'red',
  4. int thickness = 3,
})

draw a box on the supplied Image around detected object using NormalizedVertex values

Implementation

static void drawAnnotationsNormalized(
    Image image, List<NormalizedVertex> vertices,
    {String color = 'red', int thickness = 3}) {
  for (var index = 0; index < vertices.length - 1; index++) {
    final vStart = vertices[index];

    final vStop = vertices[index + 1];

    image.drawLine(
        (vStart.x * image.width).toInt(),
        (vStart.y * image.height).toInt(),
        (vStop.x * image.width).toInt(),
        (vStop.y * image.height).toInt(),
        RgbColor.name(color),
        thickness: thickness);
  }

  image.drawLine(
      (vertices.last.x * image.width).toInt(),
      (vertices.last.y * image.height).toInt(),
      (vertices.first.x * image.width).toInt(),
      (vertices.first.y * image.height).toInt(),
      RgbColor.name(color),
      thickness: thickness);
}