MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / writeFlowFile

Function writeFlowFile

CV/PWCNet/infer.py:29–44  ·  view source on GitHub ↗

According to the matlab code of Deqing Sun and c++ source code of Daniel Scharstein Contact: dqsun@cs.brown.edu Contact: schar@middlebury.edu

(filename, uv)

Source from the content-addressed store, hash-verified

27
28
29def writeFlowFile(filename, uv):
30 """
31 According to the matlab code of Deqing Sun and c++ source code of Daniel Scharstein
32 Contact: dqsun@cs.brown.edu
33 Contact: schar@middlebury.edu
34 """
35 TAG_STRING = np.array(202021.25, dtype=np.float32)
36 if uv.shape[2] != 2:
37 sys.exit("writeFlowFile: flow must have two bands!");
38 H = np.array(uv.shape[0], dtype=np.int32)
39 W = np.array(uv.shape[1], dtype=np.int32)
40 with open(filename, 'wb') as f:
41 f.write(TAG_STRING.tobytes())
42 f.write(W.tobytes())
43 f.write(H.tobytes())
44 f.write(uv.tobytes())
45
46
47def load_dict(filename_):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected