swtloc.base.GroupedComponentsBase

class swtloc.base.GroupedComponentsBase(label: int, image_height: int, image_width: int)[source]

Bases: object

Base class representing the Grouped Components found in an transformed image for example: a Word.

Methods

GroupedComponentsBase.__init__(label, ...)

Create an IndividualComponentBase object which will house the grouped components properties such as : - Various Bounding Shapes which house that particular grouped component entirely :param label: A unique identifier for this Component :type label: int :param image_height: Height of the image in which this component resides :type image_height: int :param image_width: Width of the image in which this component resides :type image_width: int

GroupedComponentsBase.addLocalization(image, ...)

Add a specific localize_type of localization to the input image.

addLocalization(image: numpy.ndarray, localize_type: str, fill: bool) numpy.ndarray[source]

Add a specific localize_type of localization to the input image. fill parameter tells whether to fill the component or not.

Parameters
  • image (np.ndarray) – Image on which localization needs to be added

  • localize_type (str) –

    Type of the localization that will be added. Can be only one of [‘bbox’, ‘bubble’, ‘polygon’]. Where

    • bbox : Bounding Box

    • bubble : Bubble Boundary

    • polygon : Contour Boundary

  • fill (bool) – Whether to fill the added localization or not

Returns

(np.ndarray) - annotated image