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="-")
| 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 |