Exemplo n.º 1
0
 def draft_vertices(self, img, vertices, color):
   vertex_count = len(vertices)
   if vertex_count == 0:
     return
   for i in range(vertex_count):
     cv2.circle(img, util.point_to_int_tuple(vertices[i]), 3, color, -1)
     cv2.line(img, util.point_to_int_tuple(vertices[i]), util.point_to_int_tuple(vertices[(i + 1) % vertex_count]), color, 1)
Exemplo n.º 2
0
 def raw_draw(self, img, vertices, color, tag):
   vertex_count = len(vertices)
   if vertex_count == 0:
     return
   for i in range(vertex_count):
     cv2.circle(img, util.point_to_int_tuple(vertices[i]), 3, color, -1)
     cv2.line(img, util.point_to_int_tuple(vertices[i]), util.point_to_int_tuple(vertices[(i + 1) % vertex_count]), color, 1)
   cv2.putText(img, tag, util.point_to_int_tuple(vertices[0]), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
Exemplo n.º 3
0
  def draw(self, img, element, color):
    vertices = element.vertices

    vertex_count = len(vertices)
    for i in range(vertex_count):
      cv2.circle(img, util.point_to_int_tuple(vertices[i]), 3, color, -1)
      cv2.line(img, util.point_to_int_tuple(vertices[i]), util.point_to_int_tuple(vertices[(i + 1) % vertex_count]), color, 1)

    # centroid = util.point_to_int_tuple(polygon.centroid)
    cv2.putText(img, element.name, util.point_to_int_tuple(vertices[0]), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)