centre_crop¶
tiatoolbox.models.architecture.utils.centre_crop
- centre_crop(img, crop_shape, data_format='NCHW')[source]¶
A function to center crop image with given crop shape.
- Parameters
img (
numpy.ndarray, torch.tensor) – Input image, should be of 3 channels.crop_shape (
numpy.ndarray, torch.tensor) – The substracted amount in the form of [substracted height, substracted width].data_format (str) – Either “NCHW” or “NHWC”.
- Returns
Cropped image.
- Return type
(
numpy.ndarray, torch.tensor)