data_juicer.ops.mapper.image_remove_background_mapper module#
- class data_juicer.ops.mapper.image_remove_background_mapper.ImageRemoveBackgroundMapper(alpha_matting: bool = False, alpha_matting_foreground_threshold: int = 240, alpha_matting_background_threshold: int = 10, alpha_matting_erode_size: int = 10, bgcolor: Tuple[int, int, int, int] | None = None, *args, **kwargs)[source]#
Bases:
MapperMapper to remove background of images
- __init__(alpha_matting: bool = False, alpha_matting_foreground_threshold: int = 240, alpha_matting_background_threshold: int = 10, alpha_matting_erode_size: int = 10, bgcolor: Tuple[int, int, int, int] | None = None, *args, **kwargs)[source]#
Initialization method.
- alpha_matting (bool, optional):
Flag indicating whether to use alpha matting. Defaults to False.
- alpha_matting_foreground_threshold (int, optional):
Foreground threshold for alpha matting. Defaults to 240.
- alpha_matting_background_threshold (int, optional):
Background threshold for alpha matting. Defaults to 10.
- alpha_matting_erode_size (int, optional):
Erosion size for alpha matting. Defaults to 10.
- bgcolor (Optional[Tuple[int, int, int, int]], optional):
Background color for the cutout image. Defaults to None.
*args (Optional[Any]): Additional positional arguments. **kwargs (Optional[Any]): Additional keyword arguments.