tfg.image.transformer.sample

Samples an image at user defined coordinates.

The warp maps target to source. In the following, A1 to An are optional batch dimensions.

image: A tensor of shape [B, H_i, W_i, C], where B is the batch size, H_i the height of the image, W_i the width of the image, and C the number of channels of the image. warp: A tensor of shape [B, A_1, ..., A_n, 2] containing the x and y coordinates at which sampling will be performed. The last dimension must be 2, representing the (x, y) coordinate where x is the index for width and y is the index for height.
resampling_type Resampling mode. Supported values are ResamplingType.NEAREST and ResamplingType.BILINEAR. border_type: Border mode. Supported values are BorderType.ZERO and BorderType.DUPLICATE. pixel_type: Pixel mode. Supported values are PixelType.INTEGER and PixelType.HALF_INTEGER. name: A name for this op. Defaults to "sample".

Tensor of sampled values from image. The output tensor shape is [B, A_1, ..., A_n, C].

ValueError If image has rank != 4. If warp has rank < 2 or its last dimension is not 2. If image and warp batch dimension does not match.