fffiloni commited on
Commit
56d6a08
1 Parent(s): 089d664

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -210,6 +210,18 @@ def infer():
210
  print(f"img1_batch shape: {img1_batch.shape}")
211
  print(f"img1_batch dtype: {img1_batch.dtype}")
212
  #res = get_warp_res(img1_batch, "predicted_flow.jpg", 'warped.png')
 
 
 
 
 
 
 
 
 
 
 
 
213
  #print(res)
214
  return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
215
  ####################################
 
210
  print(f"img1_batch shape: {img1_batch.shape}")
211
  print(f"img1_batch dtype: {img1_batch.dtype}")
212
  #res = get_warp_res(img1_batch, "predicted_flow.jpg", 'warped.png')
213
+
214
+ h, w = predicted_flows.shape[:2]
215
+ flow = predicted_flows.copy()
216
+ flow[:, :, 0] + np.arange(w)
217
+ flow[:, :, 1] + np.arange(h)[:, np.newaxis]
218
+ # print('flow stats', flow.max(), flow.min(), flow.mean())
219
+ # print(flow)
220
+ flow*1.
221
+ # print('flow stats mul', flow.max(), flow.min(), flow.mean())
222
+ # res = cv2.remap(img, flow, None, cv2.INTER_LINEAR)
223
+ res = cv2.remap(img1_batch, flow, None, cv2.INTER_LANCZOS4)
224
+
225
  #print(res)
226
  return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
227
  ####################################