Add application file
Browse files
app.py
CHANGED
|
@@ -35,7 +35,7 @@ def load_bin(file, threshold=3):
|
|
| 35 |
raw_hist = readRAW(file.name)
|
| 36 |
|
| 37 |
multishot = (raw_hist[..., 254] * 1024 + raw_hist[..., 255]).astype(np.float32)
|
| 38 |
-
normalize_data =
|
| 39 |
nor_hist = raw_hist * normalize_data[..., np.newaxis]
|
| 40 |
|
| 41 |
img = np.sum(nor_hist[:, :, :-2], axis=2)
|
|
@@ -91,8 +91,9 @@ def plot_depth(nor_hist, threshold):
|
|
| 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 |
-
|
| 95 |
arr_expandfilter = arr * modulate[np.newaxis, np.newaxis, :] * expand_filter[np.newaxis, np.newaxis, :]
|
|
|
|
| 96 |
|
| 97 |
tof = np.argmax(arr, axis=2)
|
| 98 |
tof_filter = np.argmax(arr_expandfilter, axis=2)
|
|
@@ -102,7 +103,7 @@ def plot_depth(nor_hist, threshold):
|
|
| 102 |
|
| 103 |
img_ref = to_uint8_image(ref)
|
| 104 |
img_ref_filter = to_uint8_image(ref_filter)
|
| 105 |
-
|
| 106 |
mask = ref>50
|
| 107 |
# 转uint8图像方便展示
|
| 108 |
img_tof = to_uint8_image(tof)
|
|
|
|
| 35 |
raw_hist = readRAW(file.name)
|
| 36 |
|
| 37 |
multishot = (raw_hist[..., 254] * 1024 + raw_hist[..., 255]).astype(np.float32)
|
| 38 |
+
normalize_data = 12000 / multishot
|
| 39 |
nor_hist = raw_hist * normalize_data[..., np.newaxis]
|
| 40 |
|
| 41 |
img = np.sum(nor_hist[:, :, :-2], axis=2)
|
|
|
|
| 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 |
+
print('np.max(arr,axis =(0,1,2))',np.max(arr,axis =(0,1,2)))
|
| 95 |
arr_expandfilter = arr * modulate[np.newaxis, np.newaxis, :] * expand_filter[np.newaxis, np.newaxis, :]
|
| 96 |
+
print('np.max(arr_expandfilter,axis =(0,1,2))',np.max(arr_expandfilter,axis =(0,1,2)))
|
| 97 |
|
| 98 |
tof = np.argmax(arr, axis=2)
|
| 99 |
tof_filter = np.argmax(arr_expandfilter, axis=2)
|
|
|
|
| 103 |
|
| 104 |
img_ref = to_uint8_image(ref)
|
| 105 |
img_ref_filter = to_uint8_image(ref_filter)
|
| 106 |
+
|
| 107 |
mask = ref>50
|
| 108 |
# 转uint8图像方便展示
|
| 109 |
img_tof = to_uint8_image(tof)
|