Spaces:
Build error
Build error
lemonaddie
commited on
Commit
•
d80271d
1
Parent(s):
08eb864
Update app_recon.py
Browse files- app_recon.py +4 -1
app_recon.py
CHANGED
@@ -159,7 +159,9 @@ def reconstruction(image, files):
|
|
159 |
|
160 |
img = Image.open(image)
|
161 |
|
162 |
-
|
|
|
|
|
163 |
image_nobg = remove(image_rem, alpha_matting=True)
|
164 |
arr = np.asarray(image_nobg)[:,:,-1]
|
165 |
x_nonzero = np.nonzero(arr.sum(axis=0))
|
@@ -170,6 +172,7 @@ def reconstruction(image, files):
|
|
170 |
y_max = int(y_nonzero[0].max())
|
171 |
masked_image, mask = sam_segment(sam_predictor, img.convert('RGB'), x_min, y_min, x_max, y_max)
|
172 |
|
|
|
173 |
depth_np = np.load(files[0])
|
174 |
normal_np = np.load(files[1])
|
175 |
|
|
|
159 |
|
160 |
img = Image.open(image)
|
161 |
|
162 |
+
width, height = img.size
|
163 |
+
|
164 |
+
image_rem = img.convert('RGBA').resize((width//2, height//2), Image.LANCZOS)
|
165 |
image_nobg = remove(image_rem, alpha_matting=True)
|
166 |
arr = np.asarray(image_nobg)[:,:,-1]
|
167 |
x_nonzero = np.nonzero(arr.sum(axis=0))
|
|
|
172 |
y_max = int(y_nonzero[0].max())
|
173 |
masked_image, mask = sam_segment(sam_predictor, img.convert('RGB'), x_min, y_min, x_max, y_max)
|
174 |
|
175 |
+
mask = mask.resize((width, height), Image.LANCZOS)
|
176 |
depth_np = np.load(files[0])
|
177 |
normal_np = np.load(files[1])
|
178 |
|