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

Function read_gen

core/utils/frame_utils.py:123–137  ·  view source on GitHub ↗
(file_name, pil=False)

Source from the content-addressed store, hash-verified

121
122
123def read_gen(file_name, pil=False):
124 ext = splitext(file_name)[-1]
125 if ext == '.png' or ext == '.jpeg' or ext == '.ppm' or ext == '.jpg':
126 return Image.open(file_name)
127 elif ext == '.bin' or ext == '.raw':
128 return np.load(file_name)
129 elif ext == '.flo':
130 return readFlow(file_name).astype(np.float32)
131 elif ext == '.pfm':
132 flow = readPFM(file_name).astype(np.float32)
133 if len(flow.shape) == 2:
134 return flow
135 else:
136 return flow[:, :, :-1]
137 return []

Callers

nothing calls this directly

Calls 2

readFlowFunction · 0.85
readPFMFunction · 0.85

Tested by

no test coverage detected