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

Function writeFlowFile

CV/PWCNet/train.py:34–49  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected