MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / WarpAffineTransform

Class WarpAffineTransform

tensorpack/dataflow/imgaug/transform.py:150–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148
149
150class WarpAffineTransform(Transform):
151 def __init__(self, mat, dsize, interp=cv2.INTER_LINEAR,
152 borderMode=cv2.BORDER_CONSTANT, borderValue=0):
153 super(WarpAffineTransform, self).__init__()
154 self._init(locals())
155
156 def apply_image(self, img):
157 ret = cv2.warpAffine(img, self.mat, self.dsize,
158 flags=self.interp,
159 borderMode=self.borderMode,
160 borderValue=self.borderValue)
161 if img.ndim == 3 and ret.ndim == 2:
162 ret = ret[:, :, np.newaxis]
163 return ret
164
165 def apply_coords(self, coords):
166 coords = np.concatenate((coords, np.ones((coords.shape[0], 1), dtype='f4')), axis=1)
167 coords = np.dot(coords, self.mat.T)
168 return coords
169
170
171class FlipTransform(Transform):

Callers 5

get_transformMethod · 0.85
get_transformMethod · 0.85
get_transformMethod · 0.85
get_transformMethod · 0.85
transform.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…