s6.utils.bounding_box_selectorΒΆ

class s6.utils.bounding_box_selector.BoundingBoxSelector(color=(0, 255, 0), border_width=2, show_text=True)

Bases: object

Interactive bounding box selector using OpenCV window.

Example

selector = BoundingBoxSelector(color=(0,255,0), border_width=2, show_text=True) bbox2d = selector.select(image)

Parameters:
  • color – BGR tuple for rectangle color.

  • border_width – Thickness of the rectangle border.

  • show_text – Whether to display x,y,w,h text on the rectangle.

select(image: ndarray, window_name: str = 'Select BoundingBox') BoundingBox2D

Show image in a window and let user draw a bounding box by dragging the mouse. Press Enter to confirm selection and close the window.

Parameters:
  • image – The image array to select bounding box from.

  • window_name – The name of the OpenCV window.

Returns:

The selected bounding box.

Return type:

BoundingBox2D