MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / draw_box

Method draw_box

detectron2/utils/visualizer.py:867–899  ·  view source on GitHub ↗

Args: box_coord (tuple): a tuple containing x0, y0, x1, y1 coordinates, where x0 and y0 are the coordinates of the image's top left corner. x1 and y1 are the coordinates of the image's bottom right corner. alpha (float): blending effic

(self, box_coord, alpha=0.5, edge_color="g", line_style="-")

Source from the content-addressed store, hash-verified

865 return self.output
866
867 def draw_box(self, box_coord, alpha=0.5, edge_color="g", line_style="-"):
868 """
869 Args:
870 box_coord (tuple): a tuple containing x0, y0, x1, y1 coordinates, where x0 and y0
871 are the coordinates of the image's top left corner. x1 and y1 are the
872 coordinates of the image's bottom right corner.
873 alpha (float): blending efficient. Smaller values lead to more transparent masks.
874 edge_color: color of the outline of the box. Refer to `matplotlib.colors`
875 for full list of formats that are accepted.
876 line_style (string): the string to use to create the outline of the boxes.
877
878 Returns:
879 output (VisImage): image object with box drawn.
880 """
881 x0, y0, x1, y1 = box_coord
882 width = x1 - x0
883 height = y1 - y0
884
885 linewidth = max(self._default_font_size / 4, 1)
886
887 self.output.ax.add_patch(
888 mpl.patches.Rectangle(
889 (x0, y0),
890 width,
891 height,
892 fill=False,
893 edgecolor=edge_color,
894 linewidth=linewidth * self.output.scale,
895 alpha=alpha,
896 linestyle=line_style,
897 )
898 )
899 return self.output
900
901 def draw_rotated_box_with_label(
902 self, rotated_box, alpha=0.5, edge_color="g", line_style="-", label=None

Callers 1

overlay_instancesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected