codic commited on
Commit
08794bb
·
verified ·
1 Parent(s): c506795

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -49,6 +49,10 @@ def process_image(image_path, depth_map_path=None):
49
  # Create inpainted background with OpenCV
50
  inpainted_bg = inpaint_background(image, np.array(image_raw))
51
 
 
 
 
 
52
  try:
53
  gltf_path = create_3d_obj(np.array(image), depth_image, image_path, inpainted_bg)
54
  img = Image.fromarray(depth_image)
@@ -116,7 +120,7 @@ def create_3d_obj(rgb_image, depth_image, image_path, inpainted_bg, depth=12):
116
  o3d.io.write_triangle_mesh(gltf_path, mesh_crop, write_triangle_uvs=True)
117
  return gltf_path
118
 
119
- title = "Enhanced Depth Estimation & 3D Reconstruction with Panorama Background"
120
  description = (
121
  "Upload an RGB image and optionally a depth map (image or npy) to create a 3D model. "
122
  "Background remains unchanged and un-cropped, with a panoramic effect for a more immersive experience."
 
49
  # Create inpainted background with OpenCV
50
  inpainted_bg = inpaint_background(image, np.array(image_raw))
51
 
52
+ # Resize depth_image to match inpainted_bg size
53
+ depth_image = Image.fromarray(depth_image).resize(inpainted_bg.shape[1::-1], Image.Resampling.NEAREST)
54
+ depth_image = np.array(depth_image)
55
+
56
  try:
57
  gltf_path = create_3d_obj(np.array(image), depth_image, image_path, inpainted_bg)
58
  img = Image.fromarray(depth_image)
 
120
  o3d.io.write_triangle_mesh(gltf_path, mesh_crop, write_triangle_uvs=True)
121
  return gltf_path
122
 
123
+ title = "3D Reconstruction with Panorama Background"
124
  description = (
125
  "Upload an RGB image and optionally a depth map (image or npy) to create a 3D model. "
126
  "Background remains unchanged and un-cropped, with a panoramic effect for a more immersive experience."