tf.image.crop_to_bounding_box

View source on GitHub

Crops an image to a specified bounding box.

tf.image.crop_to_bounding_box(
    image, offset_height, offset_width, target_height, target_width
)

This op cuts a rectangular part out of image. The top-left corner of the returned image is at offset_height, offset_width in image, and its lower-right corner is at offset_height + target_height, offset_width + target_width.

Args:

Returns:

If image was 4-D, a 4-D float Tensor of shape [batch, target_height, target_width, channels] If image was 3-D, a 3-D float Tensor of shape [target_height, target_width, channels]

Raises: