Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -197,11 +197,27 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', remove_bg
|
|
197 |
|
198 |
diff_d = np.abs(depth_color.astype(np.int16)-depth_color_bg.astype(np.int16))
|
199 |
diff_c = np.abs(raw_frame.astype(np.int16)-raw_frame_bg.astype(np.int16))
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
-
mask_bg = cv2.inRange(diff_d, np.array([0,0,0]), np.array([
|
204 |
-
mask_no_shadow = cv2.inRange(diff_c, np.array([0,0,0]), np.array([
|
205 |
mask_shadow = cv2.bitwise_not(mask_no_shadow)
|
206 |
|
207 |
#stereo = cv2.StereoBM.create(numDisparities=16, blockSize=15)
|
|
|
197 |
|
198 |
diff_d = np.abs(depth_color.astype(np.int16)-depth_color_bg.astype(np.int16))
|
199 |
diff_c = np.abs(raw_frame.astype(np.int16)-raw_frame_bg.astype(np.int16))
|
200 |
+
avg_d = int(np.average(diff_d))
|
201 |
+
avg_c = int(np.average(diff_c))
|
202 |
+
print('-average')
|
203 |
+
print(avg_d)
|
204 |
+
print(avg_c)
|
205 |
+
md_d = int(np.median(diff_d))
|
206 |
+
md_c = int(np.median(diff_c))
|
207 |
+
print('-median')
|
208 |
+
print(md_d)
|
209 |
+
print(md_c)
|
210 |
+
print('-most common')
|
211 |
+
c = Counter(diff_d)
|
212 |
+
value, cc = c.most_common()[0]
|
213 |
+
print(value)
|
214 |
+
c = Counter(diff_c)
|
215 |
+
value, cc = c.most_common()[0]
|
216 |
+
print(value)
|
217 |
+
print('-')
|
218 |
|
219 |
+
mask_bg = cv2.inRange(diff_d, np.array([0,0,0]), np.array([avg_d,avg_d,avg_d]))
|
220 |
+
mask_no_shadow = cv2.inRange(diff_c, np.array([0,0,0]), np.array([avg_c,avg_c,avg_c]))
|
221 |
mask_shadow = cv2.bitwise_not(mask_no_shadow)
|
222 |
|
223 |
#stereo = cv2.StereoBM.create(numDisparities=16, blockSize=15)
|