MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / translate

Function translate

tensorflow/contrib/image/python/ops/image_ops.py:102–127  ·  view source on GitHub ↗

Translate image(s) by the passed vectors(s). Args: images: A tensor of shape (num_images, num_rows, num_columns, num_channels) (NHWC), (num_rows, num_columns, num_channels) (HWC), or (num_rows, num_columns) (HW). The rank must be statically known (the shape is not `Ten

(images, translations, interpolation="NEAREST", name=None)

Source from the content-addressed store, hash-verified

100
101
102def translate(images, translations, interpolation="NEAREST", name=None):
103 """Translate image(s) by the passed vectors(s).
104
105 Args:
106 images: A tensor of shape (num_images, num_rows, num_columns, num_channels)
107 (NHWC), (num_rows, num_columns, num_channels) (HWC), or
108 (num_rows, num_columns) (HW). The rank must be statically known (the
109 shape is not `TensorShape(None)`.
110 translations: A vector representing [dx, dy] or (if images has rank 4)
111 a matrix of length num_images, with a [dx, dy] vector for each image in
112 the batch.
113 interpolation: Interpolation mode. Supported values: "NEAREST", "BILINEAR".
114 name: The name of the op.
115
116 Returns:
117 Image(s) with the same type and shape as `images`, translated by the given
118 vector(s). Empty space due to the translation will be filled with zeros.
119
120 Raises:
121 TypeError: If `image` is an invalid type.
122 """
123 with ops.name_scope(name, "translate"):
124 return transform(
125 images,
126 translations_to_projective_transforms(translations),
127 interpolation=interpolation)
128
129
130def angles_to_projective_transforms(angles,

Callers

nothing calls this directly

Calls 3

transformFunction · 0.70
name_scopeMethod · 0.45

Tested by

no test coverage detected