mmcv.image.imcrop¶
- mmcv.image.imcrop(img: ndarray, bboxes: ndarray, scale: float = 1.0, pad_fill: float | list | None = None) ndarray | List[ndarray][source]¶
Crop image patches.
3 steps: scale the bboxes -> clip bboxes -> crop and pad.
- Parameters:
img (ndarray) – Image to be cropped.
bboxes (ndarray) – Shape (k, 4) or (4, ), location of cropped bboxes.
scale (float, optional) – Scale ratio of bboxes, the default value 1.0 means no scaling.
pad_fill (Number | list[Number]) – Value to be filled for padding. Default: None, which means no padding.
- Returns:
The cropped image patches.
- Return type:
list[ndarray] | ndarray