freealise commited on
Commit
ad73ab4
1 Parent(s): 1218d88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -147,18 +147,18 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
147
 
148
  blur_frame = raw_frame.copy()
149
  i = 240
150
- j = 1
151
- while j < 33:
152
  blur_lo = np.array([i,i,i])
153
  blur_hi = np.array([i+16,i+16,i+16])
154
  blur_mask = cv2.inRange(depth_color, blur_lo, blur_hi)
155
 
156
- print(f'kernel size {j}')
157
- blur = cv2.GaussianBlur(raw_frame,(j,j),0)
158
 
159
  blur_frame[blur_mask>0] = blur[blur_mask>0]
160
  i = i - 16
161
- j = j + 2
162
 
163
  # split_region = np.ones((frame_height, margin_width, 3), dtype=np.uint8) * 255
164
  # combined_frame = cv2.hconcat([raw_frame, split_region, depth_color])
@@ -167,7 +167,7 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
167
  # frame_path = os.path.join(temp_frame_dir, f"frame_{count:05d}.png")
168
  # cv2.imwrite(frame_path, combined_frame)
169
 
170
- cv2.imwrite(f"f{count}.jpg", raw_frame)
171
  orig_frames.append(f"f{count}.jpg")
172
  cv2.imwrite(f"f{count}_dmap.jpg", depth_color)
173
  depth_frames.append(f"f{count}_dmap.jpg")
@@ -357,11 +357,8 @@ with gr.Blocks(css=css) as demo:
357
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
358
  BABYLON.Engine.LastCreatedScene.activeCamera.fov = this.value;
359
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
360
-
361
- var hb = new BABYLON.BlurPostProcess("Horizontal blur", new BABYLON.Vector2(1.0, 0), 3.0, 1.0, BABYLON.Engine.LastCreatedScene.activeCamera);
362
- var vb = new BABYLON.BlurPostProcess("Vertical blur", new BABYLON.Vector2(0, 1.0), 3.0, 1.0, BABYLON.Engine.LastCreatedScene.activeCamera);
363
-
364
- //document.getElementsByClassName(\"model3D\")[0].getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/Math.sqrt(2.0) + \"px)\";
365
  '/><span>0.8</span>""")
366
  camera = gr.HTML(value="<a href='#' onclick=\"BABYLON.Engine.LastCreatedScene.activeCamera.radius=0;\">reset camera</a>")
367
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' min='0' max='2' step='0.001' oninput='
 
147
 
148
  blur_frame = raw_frame.copy()
149
  i = 240
150
+ j = 0
151
+ while j < 16:
152
  blur_lo = np.array([i,i,i])
153
  blur_hi = np.array([i+16,i+16,i+16])
154
  blur_mask = cv2.inRange(depth_color, blur_lo, blur_hi)
155
 
156
+ print(f'standard deviation {j}')
157
+ blur = cv2.GaussianBlur(raw_frame,(0,0), pow(2,j), pow(2,j))
158
 
159
  blur_frame[blur_mask>0] = blur[blur_mask>0]
160
  i = i - 16
161
+ j = j + 1
162
 
163
  # split_region = np.ones((frame_height, margin_width, 3), dtype=np.uint8) * 255
164
  # combined_frame = cv2.hconcat([raw_frame, split_region, depth_color])
 
167
  # frame_path = os.path.join(temp_frame_dir, f"frame_{count:05d}.png")
168
  # cv2.imwrite(frame_path, combined_frame)
169
 
170
+ cv2.imwrite(f"f{count}.jpg", blur_frame)
171
  orig_frames.append(f"f{count}.jpg")
172
  cv2.imwrite(f"f{count}_dmap.jpg", depth_color)
173
  depth_frames.append(f"f{count}_dmap.jpg")
 
357
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
358
  BABYLON.Engine.LastCreatedScene.activeCamera.fov = this.value;
359
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
360
+
361
+ document.getElementsByClassName(\"model3D\")[0].getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/Math.sqrt(2.0) + \"px)\";
 
 
 
362
  '/><span>0.8</span>""")
363
  camera = gr.HTML(value="<a href='#' onclick=\"BABYLON.Engine.LastCreatedScene.activeCamera.radius=0;\">reset camera</a>")
364
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' min='0' max='2' step='0.001' oninput='