MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / draw_box

Method draw_box

utils/visualizer.py:909–941  ·  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

907 return self.output
908
909 def draw_box(self, box_coord, alpha=0.5, edge_color="g", line_style="-"):
910 """
911 Args:
912 box_coord (tuple): a tuple containing x0, y0, x1, y1 coordinates, where x0 and y0
913 are the coordinates of the image's top left corner. x1 and y1 are the
914 coordinates of the image's bottom right corner.
915 alpha (float): blending efficient. Smaller values lead to more transparent masks.
916 edge_color: color of the outline of the box. Refer to `matplotlib.colors`
917 for full list of formats that are accepted.
918 line_style (string): the string to use to create the outline of the boxes.
919
920 Returns:
921 output (VisImage): image object with box drawn.
922 """
923 x0, y0, x1, y1 = box_coord
924 width = x1 - x0
925 height = y1 - y0
926
927 linewidth = max(self._default_font_size / 4, 1)
928
929 self.output.ax.add_patch(
930 mpl.patches.Rectangle(
931 (x0, y0),
932 width,
933 height,
934 fill=False,
935 edgecolor=edge_color,
936 linewidth=linewidth * self.output.scale,
937 alpha=alpha,
938 linestyle=line_style,
939 )
940 )
941 return self.output
942
943 def draw_rotated_box_with_label(
944 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