drawAnnotations static method

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

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

Implementation

static void drawAnnotations(Image image, List<Vertex> 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, vStart.y, vStop.x, vStop.y, RgbColor.name(color),
        thickness: thickness);
  }

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