swtloc.abstractions.Word
- class swtloc.abstractions.Word(label: int, letters: List[swtloc.abstractions.Letter], image_height: int, image_width: int)[source]
Bases:
swtloc.base.GroupedComponentsBase
Word
class represents, a word - connected component which houses various properties of that individual word.Methods
Word.__init__
(label, letters, image_height, ...)Create an
Word
object which will house the grouped components properties such as : - Various Bounding Shapes which house that particular grouped component entirely :param letters: Letters which can be grouped into this word. :type letters: List[Letter] :param label: A unique identifier for this Component :type label: int :param image_height: Image height :type image_height: int :param image_width: Image Width :type image_width: int.Word.addLocalization
(image, localize_type, fill)Add a specific localize_type of localization to the input image.
- addLocalization(image: numpy.ndarray, localize_type: str, fill: bool) numpy.ndarray
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