swtloc.base.IndividualComponentBase

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

Bases: object

Base class representing the Individual Components found in an transformed image for example: a Letter.

Methods

IndividualComponentBase.__init__(label, ...)

Create an IndividualComponentBase object which will house the components properties such as : - Minimum Bounding Box & its related properties - External Bounding Box & its related properties - Outline (Contour) - Original Image Properties

IndividualComponentBase.addLocalization(...)

Add a specific localize_type of localization to the input image.

addLocalization(image: numpy.ndarray, localize_type: str, fill: bool, radius_multiplier: float = 1.0) 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 [‘min_bbox’, ‘ext_bbox’, ‘outline’, ‘circular’]. Where :

    • min_bbox : Minimum Bounding Box

    • ext_bbox : External Bounding Box

    • outline : Contour

    • circular : Circle - With Minimum Bounding Box Centre coordinate and

    radius = Minimum Bounding Box Circum Radius * radius_multiplier

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

  • radius_multiplier (float) – Minimum Bounding Box Circum Radius inflation parameter. [default = 1.0].

Returns

(np.ndarray) - annotated image