Spaces:
Starting
Starting
Update app.py
Browse files
app.py
CHANGED
@@ -135,8 +135,6 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', remove_bg
|
|
135 |
orig_frames = []
|
136 |
thumbnail_old = []
|
137 |
|
138 |
-
backSub = cv2.createBackgroundSubtractorKNN()
|
139 |
-
|
140 |
while raw_video.isOpened():
|
141 |
ret, raw_frame = raw_video.read()
|
142 |
if not ret:
|
@@ -206,16 +204,13 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', remove_bg
|
|
206 |
mask_no_shadow = cv2.inRange(diff_c, np.array([0,0,0]), np.array([16,16,16]))
|
207 |
mask_shadow = cv2.bitwise_not(mask_no_shadow)
|
208 |
|
209 |
-
|
|
|
210 |
|
211 |
m = cv2.inRange(raw_frame, np.array([255,255,255]), np.array([255,255,255]))
|
212 |
raw_frame[m>0] = (239,239,239)
|
213 |
-
|
214 |
-
|
215 |
-
raw_frame[fgMask==127] = (raw_frame[fgMask==127] / 17 + 240).astype(np.uint8)
|
216 |
-
raw_frame[fgMask==0] = (255,255,255)
|
217 |
-
depth_gray = fgMask
|
218 |
-
depth_color = cv2.cvtColor(fgMask, cv2.COLOR_GRAY2BGR)
|
219 |
|
220 |
cv2.imwrite(f"f{count}.png", raw_frame)
|
221 |
orig_frames.append(f"f{count}.png")
|
|
|
135 |
orig_frames = []
|
136 |
thumbnail_old = []
|
137 |
|
|
|
|
|
138 |
while raw_video.isOpened():
|
139 |
ret, raw_frame = raw_video.read()
|
140 |
if not ret:
|
|
|
204 |
mask_no_shadow = cv2.inRange(diff_c, np.array([0,0,0]), np.array([16,16,16]))
|
205 |
mask_shadow = cv2.bitwise_not(mask_no_shadow)
|
206 |
|
207 |
+
#stereo = cv2.StereoBM.create(numDisparities=16, blockSize=15)
|
208 |
+
#disparity = stereo.compute(raw_frame_l, raw_frame_r)
|
209 |
|
210 |
m = cv2.inRange(raw_frame, np.array([255,255,255]), np.array([255,255,255]))
|
211 |
raw_frame[m>0] = (239,239,239)
|
212 |
+
raw_frame[cv2.bitwise_and(mask_shadow, mask_bg)>0] = (raw_frame[cv2.bitwise_and(mask_shadow, mask_bg)>0] / 17 + 240).astype(np.uint8)
|
213 |
+
raw_frame[cv2.bitwise_and(mask_no_shadow, mask_bg)>0] = (255,255,255)
|
|
|
|
|
|
|
|
|
214 |
|
215 |
cv2.imwrite(f"f{count}.png", raw_frame)
|
216 |
orig_frames.append(f"f{count}.png")
|