Crops an image to a specified bounding box.
View aliases
Compat aliases for migration
See Migration guide for more details.
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 | |
---|---|
image
|
4-D Tensor of shape [batch, or 3-D Tensor
of shape [height, .
|
offset_
|
Vertical coordinate of the top-left corner of the result in the input. |
offset_
|
Horizontal coordinate of the top-left corner of the result in the input. |
target_
|
Height of the result. |
target_
|
Width of the result. |
Returns | |
---|---|
If image was 4-D, a 4-D float Tensor of shape
[batch,
If image was 3-D, a 3-D float Tensor of shape
[target_
|
Raises | |
---|---|
ValueError
|
If the shape of image is incompatible with the offset_ or
target_ arguments, or either offset_ or offset_ is
negative, or either target_ or target_ is not positive.
|