MCPcopy Create free account
hub / github.com/drinkingcoder/NeuralMarker / image_forward_warp

Function image_forward_warp

core/utils/utils.py:366–380  ·  view source on GitHub ↗

Input: image: HxWx3 numpy flow: HxWx2 torch.Tensor Output: outImg: HxWx3 numpy

(image, flow, padding_mode='zeros')

Source from the content-addressed store, hash-verified

364 return outImg.astype(np.uint8)
365
366def image_forward_warp(image, flow, padding_mode='zeros'):
367 '''
368 Input:
369 image: HxWx3 numpy
370 flow: HxWx2 torch.Tensor
371 Output:
372 outImg: HxWx3 numpy
373 '''
374 forward_warp = ForwardWarp()
375 image = torch.from_numpy(image).permute([2,0,1])[None].cuda()
376 flow = torch.from_numpy(flow).permute([2,0,1])[None].cuda()
377 out = forward_warp(image, flow)
378 image = (out[0][0] / (out[1][0] + 1e-6)).cpu().permute([1,2,0]).numpy().astype(np.uint8)
379
380 return image

Callers

nothing calls this directly

Calls 1

ForwardWarpClass · 0.90

Tested by

no test coverage detected