Shortcuts

mmcv.image.cutout

mmcv.image.cutout(img: ndarray, shape: int | Tuple[int, int], pad_val: int | float | tuple = 0) ndarray[source]

Randomly cut out a rectangle from the original img.

Parameters:
  • img (ndarray) – Image to be cutout.

  • shape (int | tuple[int]) – Expected cutout shape (h, w). If given as a int, the value will be used for both h and w.

  • pad_val (int | float | tuple[int | float]) – Values to be filled in the cut area. Defaults to 0.

Returns:

The cutout image.

Return type:

ndarray