Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -222,6 +222,8 @@ def pano_depth_to_world_points(depth):
|
|
222 |
depth[depth.shape[0]-1:depth.shape[0], 0:depth.shape[1]] = 255
|
223 |
mask = cv2.inRange(depth[int(depth.shape[0]/8*6.5):depth.shape[0]-1, 0:depth.shape[1]], 160, 255)
|
224 |
depth[int(depth.shape[0]/8*6.5):depth.shape[0]-1, 0:depth.shape[1]][mask>0] = 160
|
|
|
|
|
225 |
|
226 |
# Convert depth to radius
|
227 |
radius = (255 - depth.flatten())
|
@@ -275,7 +277,7 @@ def get_mesh(image, depth, blur_data, loadall):
|
|
275 |
|
276 |
depthc = cv2.cvtColor(depth["background"], cv2.COLOR_RGBA2RGB)
|
277 |
blur_img = blur_image(image[fnum][0], depthc, blur_data)
|
278 |
-
gdepth = rgb2gray(depthc)
|
279 |
|
280 |
print('depth to gray - ok')
|
281 |
points = pano_depth_to_world_points(gdepth)
|
|
|
222 |
depth[depth.shape[0]-1:depth.shape[0], 0:depth.shape[1]] = 255
|
223 |
mask = cv2.inRange(depth[int(depth.shape[0]/8*6.5):depth.shape[0]-1, 0:depth.shape[1]], 160, 255)
|
224 |
depth[int(depth.shape[0]/8*6.5):depth.shape[0]-1, 0:depth.shape[1]][mask>0] = 160
|
225 |
+
mask = cv2.inRange(depth, 192, 255)
|
226 |
+
depth[mask>0] = 255
|
227 |
|
228 |
# Convert depth to radius
|
229 |
radius = (255 - depth.flatten())
|
|
|
277 |
|
278 |
depthc = cv2.cvtColor(depth["background"], cv2.COLOR_RGBA2RGB)
|
279 |
blur_img = blur_image(image[fnum][0], depthc, blur_data)
|
280 |
+
gdepth = cv2.cvtColor(depthc, cv2.COLOR_RGB2GRAY) #rgb2gray(depthc)
|
281 |
|
282 |
print('depth to gray - ok')
|
283 |
points = pano_depth_to_world_points(gdepth)
|