tlc.core.builtins.types.bb_crop_interface#

Module Contents#

Classes#

Class

Description

BBCropInterface

Interface for creating bounding box crops.

API#

class tlc.core.builtins.types.bb_crop_interface.BBCropInterface#

Interface for creating bounding box crops.

static crop(image_path: str | PIL.Image.Image, bb_dict: dict[str, float | int], bb_schema: tlc.core.schema.Schema, image_height: int = 0, image_width: int = 0) PIL.Image.Image#

Crops an image according to a bounding box and returns the cropped image.

Parameters:
  • image_path – Path to the image to crop.

  • bb_dict – Dictionary containing bounding box coordinates under the keys X0, Y0, X1, Y1.

  • bb_schema – Schema for the bounding box.

  • image_height – Height of the original image (only necessary if box is in relative coordinates).

  • image_width – Width of the original image (only necessary if box is in relative coordinates).

Returns:

Cropped image.