csuhan commited on
Commit
653564f
1 Parent(s): 578e7e2

Upload folder using huggingface_hub

Browse files
app.py CHANGED
@@ -73,6 +73,9 @@ def load_fmri(fmri_path):
73
  return data
74
 
75
  def load_rgbx(image_path, x_image_path):
 
 
 
76
  image = Image.open(image_path).convert('RGB')
77
  x_image = Image.open(x_image_path).convert('RGB')
78
  x_image = x_image.resize(image.size[-2:])
@@ -339,7 +342,7 @@ def gradio_worker(
339
  depth_rgb_path = gr.Image(label='RGB Image', type='filepath')
340
  gr.Examples(
341
  examples=[
342
- [rgb_image.replace('rgb', 'depth'), rgb_image]
343
  for rgb_image in glob.glob("examples/depth_normal/rgb/*.png")[:9]
344
  ],
345
  inputs=[depth_path, depth_rgb_path],
 
73
  return data
74
 
75
  def load_rgbx(image_path, x_image_path):
76
+ # trick: replace path if 'depth_scaled' in path
77
+ x_image_path = x_image_path.replace('depth_scaled', 'depth')
78
+
79
  image = Image.open(image_path).convert('RGB')
80
  x_image = Image.open(x_image_path).convert('RGB')
81
  x_image = x_image.resize(image.size[-2:])
 
342
  depth_rgb_path = gr.Image(label='RGB Image', type='filepath')
343
  gr.Examples(
344
  examples=[
345
+ [rgb_image.replace('rgb', 'depth_scaled'), rgb_image]
346
  for rgb_image in glob.glob("examples/depth_normal/rgb/*.png")[:9]
347
  ],
348
  inputs=[depth_path, depth_rgb_path],
examples/depth_normal/depth_scaled/0084.png ADDED
examples/depth_normal/depth_scaled/0131.png ADDED
examples/depth_normal/depth_scaled/0297.png ADDED
examples/depth_normal/depth_scaled/0331.png ADDED
examples/depth_normal/depth_scaled/0432.png ADDED
examples/depth_normal/depth_scaled/0633.png ADDED
examples/depth_normal/depth_scaled/0663.png ADDED
examples/depth_normal/depth_scaled/0771.png ADDED
examples/depth_normal/depth_scaled/0782.png ADDED
examples/depth_normal/depth_scaled/1001.png ADDED
examples/depth_normal/depth_scaled/1051.png ADDED
examples/depth_normal/depth_scaled/1129.png ADDED
examples/depth_normal/depth_scaled/1205.png ADDED
examples/depth_normal/depth_scaled/1336.png ADDED
examples/depth_normal/depth_scaled/1383.png ADDED
examples/depth_normal/depth_scaled/1386.png ADDED
examples/depth_normal/depth_scaled/1393.png ADDED
examples/depth_normal/depth_scaled/1447.png ADDED
examples/depth_normal/depth_scaled/scale_gray_image.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from PIL import Image
3
+ import glob
4
+ import numpy as np
5
+
6
+ files = glob.glob('examples/depth_normal/depth/*')
7
+
8
+ for file in files:
9
+ img = Image.open(file)
10
+ img = np.array(img)
11
+ img = (img - img.min()) / (img.max() - img.min()) * 255
12
+ # img = img / img.max() * 255
13
+ img = np.array(img, dtype=np.uint8)
14
+ img = Image.fromarray(img)
15
+ img.save(file.replace('depth_normal/depth', 'depth_normal/depth_scaled'))