center_crop

Contents

center_crop#

ptyrad.utils.image_proc.center_crop(image, crop_height, crop_width, offset=(0, 0))[source]#

Center crops a 2D or 3D array (e.g., an image).

Parameters:
  • image (numpy.ndarray) – The input array to crop. Can be 2D (H, W) or 3D (H, W, C).

  • crop_height (int) – The desired height of the crop.

  • crop_width (int) – The desired width of the crop.

Returns:

The cropped image.

Return type:

numpy.ndarray