Shortcuts

mmcv.image.imcrop

mmcv.image.imcrop(img: numpy.ndarray, bboxes: numpy.ndarray, scale: float = 1.0, pad_fill: Optional[Union[float, list]] = None)Union[numpy.ndarray, List[numpy.ndarray]][源代码]

Crop image patches.

3 steps: scale the bboxes -> clip bboxes -> crop and pad.

参数
  • 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.

返回

The cropped image patches.

返回类型

list[ndarray] | ndarray