Description Usage Arguments Details Value Raises Note Examples
Image warping using per-pixel flow vectors.
1 | img_dense_image_warp(image, flow, name = NULL)
|
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). |
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.
A 4-D float 'Tensor' with shape'[batch, height, width, channels]' and same type as input image.
ValueError: if height < 2 or width < 2 or the inputs have the wrong number of dimensions.
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.
1 2 3 4 5 6 7 | ## Not run:
flow_shape = list(1L, as.integer(input_img$shape[[2]]), as.integer(input_img$shape[[3]]), 2L)
init_flows = tf$random$normal(flow_shape) * 2.0
dense_img_warp = img_dense_image_warp(input_img, init_flows)
dense_img_warp = tf$squeeze(dense_img_warp, 0)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.