tf.contrib.image.dense_image_warp
Stay organized with collections
Save and categorize content based on your preferences.
Image warping using per-pixel flow vectors.
tf.contrib.image.dense_image_warp(
image, flow, name='dense_image_warp'
)
Apply a non-linear warp to the image, where the warp is specified by a dense
flow field of offset vectors that define the correspondences of pixel values
in the output image back to locations in the source image. Specifically, the
pixel value at output[b, j, i, c] is
images[b, j - flow[b, j, i, 0], i - flow[b, j, i, 1], c].
The locations specified by this formula do not necessarily map to an int
index. Therefore, the pixel value is obtained by bilinear
interpolation of the 4 nearest pixels around
(b, j - flow[b, j, i, 0], i - flow[b, j, i, 1]). For locations outside
of the image, we use the nearest pixel values at the image boundary.
Args |
image
|
4-D float Tensor with shape [batch, height, width, channels] .
|
flow
|
A 4-D float Tensor with shape [batch, height, width, 2] .
|
name
|
A name for the operation (optional).
Note that image and flow can be of type tf.half, tf.float32, or tf.float64,
and do not necessarily have to be the same type.
|
Returns |
A 4-D float Tensor with shape[batch, height, width, channels]
and same type as input image.
|
Raises |
ValueError
|
if height < 2 or width < 2 or the inputs have the wrong number
of dimensions.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.image.dense_image_warp\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/image/python/ops/dense_image_warp.py#L165-L218) |\n\nImage warping using per-pixel flow vectors. \n\n tf.contrib.image.dense_image_warp(\n image, flow, name='dense_image_warp'\n )\n\nApply a non-linear warp to the image, where the warp is specified by a dense\nflow field of offset vectors that define the correspondences of pixel values\nin the output image back to locations in the source image. Specifically, the\npixel value at output\\[b, j, i, c\\] is\nimages\\[b, j - flow\\[b, j, i, 0\\], i - flow\\[b, j, i, 1\\], c\\].\n\nThe locations specified by this formula do not necessarily map to an int\nindex. Therefore, the pixel value is obtained by bilinear\ninterpolation of the 4 nearest pixels around\n(b, j - flow\\[b, j, i, 0\\], i - flow\\[b, j, i, 1\\]). For locations outside\nof the image, we use the nearest pixel values at the image boundary.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `image` | 4-D float `Tensor` with shape `[batch, height, width, channels]`. |\n| `flow` | A 4-D float `Tensor` with shape `[batch, height, width, 2]`. |\n| `name` | A name for the operation (optional). \u003cbr /\u003e Note that image and flow can be of type tf.half, tf.float32, or tf.float64, and do not necessarily have to be the same type. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A 4-D float `Tensor` with shape`[batch, height, width, channels]` and same type as input image. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|---------------------------------------------------------------------------------|\n| `ValueError` | if height \\\u003c 2 or width \\\u003c 2 or the inputs have the wrong number of dimensions. |\n\n\u003cbr /\u003e"]]