MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / draw_rect

Function draw_rect

examples/SpatialTransformer/mnist-addition.py:216–222  ·  view source on GitHub ↗
(img, affine, c, offset=(0, 0))

Source from the content-addressed store, hash-verified

214 [0, WARP_TARGET_SIZE, 1]], dtype='float32')
215
216 def draw_rect(img, affine, c, offset=(0, 0)):
217 a = np.transpose(affine) # 3x2
218 a = (np.matmul(xys, a) + list(offset)).astype('int32')
219 cv2.line(img, tuple(a[0][::-1]), tuple(a[1][::-1]), c)
220 cv2.line(img, tuple(a[1][::-1]), tuple(a[2][::-1]), c)
221 cv2.line(img, tuple(a[2][::-1]), tuple(a[3][::-1]), c)
222 cv2.line(img, tuple(a[3][::-1]), tuple(a[0][::-1]), c)
223
224 ds = get_data(False)
225 ds.reset_state()

Callers 1

view_warpFunction · 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…