tf.image.central_crop

View source on GitHub

Crop the central region of the image(s).

tf.image.central_crop(
    image, central_fraction
)

Remove the outer parts of an image but retain the central region of the image along each dimension. If we specify central_fraction = 0.5, this function returns the region marked with "X" in the below diagram.

--------
|        |
|  XXXX  |
|  XXXX  |
|        |   where "X" is the central 50% of the image.
 --------

This function works on either a single image (image is a 3-D Tensor), or a batch of images (image is a 4-D Tensor).

Args:

Raises:

Returns:

3-D / 4-D float Tensor, as per the input.