UNPKG

2.18 kBTypeScriptView Raw
1/// <amd-module name="@tensorflow/tfjs-core/dist/ops/image/transform" />
2import { Tensor2D, Tensor4D } from '../../tensor';
3import { TensorLike } from '../../types';
4/**
5 * Applies the given transform(s) to the image(s).
6 *
7 * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.
8 * @param transforms Projective transform matrix/matrices. A tensor1d of length
9 * 8 or tensor of size N x 8. If one row of transforms is [a0, a1, a2, b0
10 * b1, b2, c0, c1], then it maps the output point (x, y) to a transformed
11 * input point (x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k),
12 * where k = c0 x + c1 y + 1. The transforms are inverted compared to the
13 * transform mapping input points to output points.
14 * @param interpolation Interpolation mode.
15 * Supported values: 'nearest', 'bilinear'. Default to 'nearest'.
16 * @param fillMode Points outside the boundaries of the input are filled
17 * according to the given mode, one of 'constant', 'reflect', 'wrap',
18 * 'nearest'. Default to 'constant'.
19 * 'reflect': (d c b a | a b c d | d c b a ) The input is extended by
20 * reflecting about the edge of the last pixel.
21 * 'constant': (k k k k | a b c d | k k k k) The input is extended by
22 * filling all values beyond the edge with the same constant value k.
23 * 'wrap': (a b c d | a b c d | a b c d) The input is extended by
24 * wrapping around to the opposite edge.
25 * 'nearest': (a a a a | a b c d | d d d d) The input is extended by
26 * the nearest pixel.
27 * @param fillValue A float represents the value to be filled outside the
28 * boundaries when fillMode is 'constant'.
29 * @param Output dimension after the transform, [height, width]. If undefined,
30 * output is the same size as input image.
31 *
32 * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}
33 */
34declare function transform_(image: Tensor4D | TensorLike, transforms: Tensor2D | TensorLike, interpolation?: 'nearest' | 'bilinear', fillMode?: 'constant' | 'reflect' | 'wrap' | 'nearest', fillValue?: number, outputShape?: [number, number]): Tensor4D;
35export declare const transform: typeof transform_;
36export {};