Merge pull request #36056 from rickwierenga:patch-2
PiperOrigin-RevId: 290945755 Change-Id: I3c85668d011971bf97d6f3e75b6393e5f83cc98b
This commit is contained in:
commit
ed67efb734
@ -849,6 +849,31 @@ def pad_to_bounding_box(image, offset_height, offset_width, target_height,
|
||||
|
||||
This op does nothing if `offset_*` is zero and the image already has size
|
||||
`target_height` by `target_width`.
|
||||
|
||||
Usage Example:
|
||||
>>> x = [[[1., 2., 3.],
|
||||
... [4., 5., 6.]],
|
||||
... [[7., 8., 9.],
|
||||
... [10., 11., 12.]]]
|
||||
>>> padded_image = tf.image.pad_to_bounding_box(x, 1, 1, 4, 4)
|
||||
>>> padded_image
|
||||
<tf.Tensor: shape=(4, 4, 3), dtype=float32, numpy=
|
||||
array([[[ 0., 0., 0.],
|
||||
[ 0., 0., 0.],
|
||||
[ 0., 0., 0.],
|
||||
[ 0., 0., 0.]],
|
||||
[[ 0., 0., 0.],
|
||||
[ 1., 2., 3.],
|
||||
[ 4., 5., 6.],
|
||||
[ 0., 0., 0.]],
|
||||
[[ 0., 0., 0.],
|
||||
[ 7., 8., 9.],
|
||||
[10., 11., 12.],
|
||||
[ 0., 0., 0.]],
|
||||
[[ 0., 0., 0.],
|
||||
[ 0., 0., 0.],
|
||||
[ 0., 0., 0.],
|
||||
[ 0., 0., 0.]]], dtype=float32)>
|
||||
|
||||
Args:
|
||||
image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor
|
||||
|
Loading…
Reference in New Issue
Block a user