JohnChiu commited on
Commit
d83fd16
·
1 Parent(s): 2abf7dc

Add application file

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -81,8 +81,6 @@ def plot_depth(nor_hist):
81
  modulate1 = np.arange(1, 181)
82
  modulate = (modulate1 * modulate1) / (180 * 180)
83
 
84
- arr = output[:, :, :180] * modulate[np.newaxis, np.newaxis, :]
85
-
86
  tc_bin = np.sum(arr, axis=(0,1))
87
  max_id = np.argmax(tc_bin[:-2])
88
 
@@ -91,7 +89,8 @@ def plot_depth(nor_hist):
91
  pad_tail = np.ones(180 - len(pad_head) - len(expand_kernel))
92
  expand_filter = np.concatenate([pad_head, expand_kernel, pad_tail])
93
 
94
- arr_expandfilter = arr * expand_filter[np.newaxis, np.newaxis, :]
 
95
 
96
  tof = np.argmax(arr, axis=2)
97
  tof_filter = np.argmax(arr_expandfilter, axis=2)
@@ -110,8 +109,8 @@ def plot_depth(nor_hist):
110
  colored_tof = cv2.applyColorMap(img_tof, cv2.COLORMAP_VIRIDIS)[:, :, ::-1]
111
  colored_tof_filter = cv2.applyColorMap(img_filter, cv2.COLORMAP_VIRIDIS)[:, :, ::-1]
112
 
113
- # return [colored_tof, colored_tof_filter]
114
- return [img_ref, img_ref_filter]
115
 
116
 
117
  with gr.Blocks() as demo:
 
81
  modulate1 = np.arange(1, 181)
82
  modulate = (modulate1 * modulate1) / (180 * 180)
83
 
 
 
84
  tc_bin = np.sum(arr, axis=(0,1))
85
  max_id = np.argmax(tc_bin[:-2])
86
 
 
89
  pad_tail = np.ones(180 - len(pad_head) - len(expand_kernel))
90
  expand_filter = np.concatenate([pad_head, expand_kernel, pad_tail])
91
 
92
+ arr = output[:, :, :180]
93
+ arr_expandfilter = arr * modulate[np.newaxis, np.newaxis, :]
94
 
95
  tof = np.argmax(arr, axis=2)
96
  tof_filter = np.argmax(arr_expandfilter, axis=2)
 
109
  colored_tof = cv2.applyColorMap(img_tof, cv2.COLORMAP_VIRIDIS)[:, :, ::-1]
110
  colored_tof_filter = cv2.applyColorMap(img_filter, cv2.COLORMAP_VIRIDIS)[:, :, ::-1]
111
 
112
+ return [colored_tof, colored_tof_filter]
113
+ # return [img_ref, img_ref_filter]
114
 
115
 
116
  with gr.Blocks() as demo: