W3cubDocs

/TensorFlow Python

tf.image.central_crop

tf.image.central_crop(
    image,
    central_fraction
)

Defined in tensorflow/python/ops/image_ops_impl.py.

See the guide: Images > Cropping

Crop the central region of the image.

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.
 --------

Args:

  • image: 3-D float Tensor of shape [height, width, depth]
  • central_fraction: float (0, 1], fraction of size to crop

Raises:

  • ValueError: if central_crop_fraction is not within (0, 1].

Returns:

3-D float Tensor

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/image/central_crop