codic commited on
Commit
20296cf
·
verified ·
1 Parent(s): 158f98c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -100,21 +100,9 @@ def predict_depth(image: Image.Image):
100
 
101
  # Convert depth map to float for filtering
102
  depth_array = np.array(depth_16bit_image, dtype=np.float32)
103
-
104
- depth_bilateral = cv2.bilateralFilter(
105
- (depth_array / 65535 * 255).astype(np.uint8),
106
- d=7, # Keep the same or slightly lower
107
- sigmaColor=20, # Reduce this for less aggressive edge preservation
108
- sigmaSpace=20 # Reduce this for less spatial smoothing
109
- )
110
- depth_bilateral = depth_bilateral.astype(np.float32) / 255 * 65535 # Back to 16-bit scale
111
- depth_sharpened = cv2.bilateralFilter(depth_bilateral, 15, 75, 75)
112
- # Normalize to 16-bit for consistent scaling
113
- depth_normalized = cv2.normalize(depth_sharpened, None, 0, 65535, cv2.NORM_MINMAX, dtype=cv2.CV_16U)
114
-
115
  # Resize depth map to match the foreground size
116
  depth_resized = cv2.resize(
117
- depth_normalized, (foreground.size[0], foreground.size[1]), interpolation=cv2.INTER_LANCZOS4
118
  )
119
 
120
  # Apply a foreground mask
 
100
 
101
  # Convert depth map to float for filtering
102
  depth_array = np.array(depth_16bit_image, dtype=np.float32)
 
 
 
 
 
 
 
 
 
 
 
 
103
  # Resize depth map to match the foreground size
104
  depth_resized = cv2.resize(
105
+ depth_array, (foreground.size[0], foreground.size[1]), interpolation=cv2.INTER_LANCZOS4
106
  )
107
 
108
  # Apply a foreground mask