class
CenterCrop
extends
_NoParamsGeometricTransform[Empty]CenterCrop(height: int, width: int, p: float = 1.0)Crop a centred height x width window (Albumentations CenterCrop).
Computes a deterministic crop centred on the input — top-left at
(round((H - height) / 2), round((W - width) / 2)) — and applies the same
offsets to mask / boxes / keypoints so every target stays aligned.
Parameters
heightintTarget crop height in pixels.
widthintTarget crop width in pixels.
pfloat= 1.0Probability of applying the transform.
Examples
>>> import lucid, lucid.utils.transforms as T
>>> tf = T.CenterCrop(16, 16, p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 16, 16)