MCPcopy Create free account
hub / github.com/charigyang/motiongrouping / writeFlowFile

Function writeFlowFile

raft/predict.py:21–36  ·  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

19DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
20
21def writeFlowFile(filename, uv):
22 """
23 According to the matlab code of Deqing Sun and c++ source code of Daniel Scharstein
24 Contact: dqsun@cs.brown.edu
25 Contact: schar@middlebury.edu
26 """
27 TAG_STRING = np.array(202021.25, dtype=np.float32)
28 if uv.shape[2] != 2:
29 sys.exit("writeFlowFile: flow must have two bands!")
30 H = np.array(uv.shape[0], dtype=np.int32)
31 W = np.array(uv.shape[1], dtype=np.int32)
32 with open(filename, 'wb') as f:
33 f.write(TAG_STRING.tobytes())
34 f.write(W.tobytes())
35 f.write(H.tobytes())
36 f.write(uv.tobytes())
37
38
39def load_image(imfile, resolution=None):

Callers 1

predictFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected