Skip to main content

centercrop

centercrop(img: np.ndarray) -> np.ndarray

  • Description: Performs a center crop on the input image.

  • Parameters

    • img (np.ndarray): The input image to be center-cropped.
  • Returns

    • np.ndarray: The cropped image.
  • Example

    import capybara as cb

    img = cb.imread('lena.png')
    img = cb.imresize(img, [128, 256])
    crop_img = cb.centercrop(img)

    The green box represents the area of the center crop.

    centercrop