freealise commited on
Commit
1c562ea
·
verified ·
1 Parent(s): 7b0ae76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -222,6 +222,15 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits', blur_data
222
  thumbnail_old = thumbnail
223
 
224
  blur_frame = blur_image(raw_frame, depth_color, blur_data)
 
 
 
 
 
 
 
 
 
225
 
226
  cv2.imwrite(f"f{count}.jpg", blur_frame)
227
  orig_frames.append(f"f{count}.jpg")
 
222
  thumbnail_old = thumbnail
223
 
224
  blur_frame = blur_image(raw_frame, depth_color, blur_data)
225
+
226
+ # encoding depth within original video
227
+ blur_frame = (round(blur_frame / 17) * 17).astype(np.uint8)
228
+ depth_r = round(depth_gray / 17).astype(np.uint8)
229
+ # may use green channel for 16 levels of opacity
230
+ depth_b = depth_gray - depth_r * 17
231
+ blur_frame[:,:,0] = blur_frame[:,:,0] + depth_r
232
+ # blur_frame[:,:,1] = blur_frame[:,:,1] + opacity_g
233
+ blur_frame[:,:,2] = blur_frame[:,:,2] + depth_b
234
 
235
  cv2.imwrite(f"f{count}.jpg", blur_frame)
236
  orig_frames.append(f"f{count}.jpg")