ImageContainer.generate_equal_crops

ImageContainer.generate_equal_crops#

ImageContainer.generate_equal_crops(size=None, as_array=False, squeeze=True, **kwargs)[source]#

Decompose image into equally sized crops.

Parameters:
size int | float | tuple[int | float, int | float] | None (default: None)

Size of the crop as (height, width). If a single int, the crop will be a square.

as_array str | bool (default: False)

squeeze bool (default: True)

Remove singleton dimensions from the results if as_array = True.

kwargs Any

Keyword arguments for crop_corner().

Yields:

The crops, whose type depends on as_array.

Return type:

Iterator[ImageContainer] | Iterator[dict[str, NDArray[Any]]]

Notes

Crops going outside out of the image boundary are padded with cval.