You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Draws bounding boxes on the frame using the detections provided.
49
+
50
+
Parameters:
51
+
scene (np.ndarray): The image on which the bounding boxes will be drawn
52
+
detections (Detections): The detections for which the bounding boxes will be drawn
53
+
labels (Optional[List[str]]): An optional list of labels corresponding to each detection. If labels is provided, the confidence score of the detection will be replaced with the label.
54
+
skip_label (bool): Is set to True, skips bounding box label annotation.
55
+
Returns:
56
+
np.ndarray: The image with the bounding boxes drawn on it
A class for drawing bounding boxes on an image using detections provided.
290
-
291
-
Attributes:
292
-
color (Union[Color, ColorPalette]): The color to draw the bounding box, can be a single color or a color palette
293
-
thickness (int): The thickness of the bounding box lines, default is 2
294
-
text_color (Color): The color of the text on the bounding box, default is white
295
-
text_scale (float): The scale of the text on the bounding box, default is 0.5
296
-
text_thickness (int): The thickness of the text on the bounding box, default is 1
297
-
text_padding (int): The padding around the text on the bounding box, default is 5
298
-
299
-
"""
300
-
self.color: Union[Color, ColorPalette] =color
301
-
self.thickness: int=thickness
302
-
self.text_color: Color=text_color
303
-
self.text_scale: float=text_scale
304
-
self.text_thickness: int=text_thickness
305
-
self.text_padding: int=text_padding
306
-
307
-
defannotate(
308
-
self,
309
-
scene: np.ndarray,
310
-
detections: Detections,
311
-
labels: Optional[List[str]] =None,
312
-
skip_label: bool=False,
313
-
) ->np.ndarray:
314
-
"""
315
-
Draws bounding boxes on the frame using the detections provided.
316
-
317
-
Parameters:
318
-
scene (np.ndarray): The image on which the bounding boxes will be drawn
319
-
detections (Detections): The detections for which the bounding boxes will be drawn
320
-
labels (Optional[List[str]]): An optional list of labels corresponding to each detection. If labels is provided, the confidence score of the detection will be replaced with the label.
321
-
skip_label (bool): Is set to True, skips bounding box label annotation.
322
-
Returns:
323
-
np.ndarray: The image with the bounding boxes drawn on it
0 commit comments