Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -138,7 +138,15 @@ def floorplan_generation(outline, num_of_rooms):
|
|
138 |
mask_gray = cv2.cvtColor(mask_bgr, cv2.COLOR_RGB2GRAY)
|
139 |
mask_white = cv2.threshold(mask_gray, 210, 255, cv2.THRESH_BINARY_INV)[1]
|
140 |
image_arr[mask_white<250]=(255,255,255)
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
image_lst.append(image)
|
143 |
|
144 |
return image_lst[0], image_lst[1], image_lst[2], image_lst[3], image_lst[4]
|
|
|
138 |
mask_gray = cv2.cvtColor(mask_bgr, cv2.COLOR_RGB2GRAY)
|
139 |
mask_white = cv2.threshold(mask_gray, 210, 255, cv2.THRESH_BINARY_INV)[1]
|
140 |
image_arr[mask_white<250]=(255,255,255)
|
141 |
+
|
142 |
+
|
143 |
+
src = image_arr
|
144 |
+
tmp = cv2.cvtColor(src, cv2.COLOR_RGB2GRAY)
|
145 |
+
_,alpha = cv2.threshold(tmp,250,255,cv2.THRESH_BINARY_INV)
|
146 |
+
b, g, r = cv2.split(src)
|
147 |
+
rgba = [b,g,r, alpha]
|
148 |
+
dst = cv2.merge(rgba,4)
|
149 |
+
image = Image.fromarray(dst)
|
150 |
image_lst.append(image)
|
151 |
|
152 |
return image_lst[0], image_lst[1], image_lst[2], image_lst[3], image_lst[4]
|