MCPcopy Create free account
hub / github.com/DPS2022/diffusion-posterior-sampling / highlight_flow

Function highlight_flow

util/tools.py:336–351  ·  view source on GitHub ↗

Convert flow into middlebury color code image.

(flow)

Source from the content-addressed store, hash-verified

334
335
336def highlight_flow(flow):
337 """Convert flow into middlebury color code image.
338 """
339 out = []
340 s = flow.shape
341 for i in range(flow.shape[0]):
342 img = np.ones((s[1], s[2], 3)) * 144.
343 u = flow[i, :, :, 0]
344 v = flow[i, :, :, 1]
345 for h in range(s[1]):
346 for w in range(s[1]):
347 ui = u[h, w]
348 vi = v[h, w]
349 img[ui, vi, :] = 255.
350 out.append(img)
351 return np.float32(np.uint8(out))
352
353
354def pt_highlight_flow(flow):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected