fffiloni commited on
Commit
2e90b3c
·
1 Parent(s): e6f82a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -215,7 +215,17 @@ def infer():
215
  print(f"numpy_array_flow: {numpy_array_flow}")
216
  print(f"numpy_array_flow shape: {numpy_array_flow.shape}")
217
  print(f"numpy_array_flow dtype: {numpy_array_flow.dtype}")
218
-
 
 
 
 
 
 
 
 
 
 
219
  #print(res)
220
  return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
221
  ####################################
 
215
  print(f"numpy_array_flow: {numpy_array_flow}")
216
  print(f"numpy_array_flow shape: {numpy_array_flow.shape}")
217
  print(f"numpy_array_flow dtype: {numpy_array_flow.dtype}")
218
+
219
+ h, w = numpy_array_flow.shape[:2]
220
+ numpy_array_flow = numpy_array_flow.copy()
221
+ numpy_array_flow[:, :, 0] + np.arange(w)
222
+ numpy_array_flow[:, :, 1] + np.arange(h)[:, np.newaxis]
223
+ # print('flow stats', flow.max(), flow.min(), flow.mean())
224
+ # print(flow)
225
+ numpy_array_flow*1.
226
+ # print('flow stats mul', flow.max(), flow.min(), flow.mean())
227
+ # res = cv2.remap(img, flow, None, cv2.INTER_LINEAR)
228
+ res = cv2.remap(frame1pil, numpy_array_flow, None, cv2.INTER_LANCZOS4)
229
  #print(res)
230
  return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
231
  ####################################