Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -138,9 +138,16 @@ 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 |
|
143 |
-
src =
|
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)
|
|
|
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 |
+
image_arr_copy = image_arr.copy()
|
142 |
+
|
143 |
+
gray = cv2.cvtColor(image_arr, cv2.COLOR_BGR2GRAY)
|
144 |
+
thresh = cv2.threshold(gray, 250, 255, cv2.THRESH_BINARY_INV)[1]
|
145 |
+
|
146 |
+
x,y,w,h = cv2.boundingRect(thresh)
|
147 |
+
image_final = image_arr_copy[y:y+h, x:x+w]
|
148 |
|
149 |
|
150 |
+
src = image_final
|
151 |
tmp = cv2.cvtColor(src, cv2.COLOR_RGB2GRAY)
|
152 |
_,alpha = cv2.threshold(tmp,250,255,cv2.THRESH_BINARY_INV)
|
153 |
b, g, r = cv2.split(src)
|