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 (ndarray, torch.tensor) – input image, should be of 3 channels
crop_shape (ndarray, torch.tensor) – the substracted amount in the form of [substracted height, substracted width].
data_format (str) – choose either NCHW or NHWC
- Returns
(ndarray, torch.tensor) Cropped image.