Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -242,23 +242,6 @@ def shrink_bbox(image: np.ndarray, shrink_factor: float):
|
|
242 |
return cropped_image
|
243 |
|
244 |
|
245 |
-
# def to_dxf(outlines):
|
246 |
-
# upper_range_tuple = (200)
|
247 |
-
# lower_range_tuple = (0)
|
248 |
-
|
249 |
-
# doc = ezdxf.new('R2010')
|
250 |
-
# msp = doc.modelspace()
|
251 |
-
# masked_jpg = cv2.inRange(outlines,lower_range_tuple, upper_range_tuple)
|
252 |
-
|
253 |
-
# for i in range(0,masked_jpg.shape[0]):
|
254 |
-
# for j in range(0,masked_jpg.shape[1]):
|
255 |
-
# if masked_jpg[i][j] == 255:
|
256 |
-
# msp.add_line((j,masked_jpg.shape[0] - i), (j,masked_jpg.shape[0] - i))
|
257 |
-
|
258 |
-
# doc.saveas("./outputs/out.dxf")
|
259 |
-
# return "./outputs/out.dxf"
|
260 |
-
|
261 |
-
|
262 |
def to_dxf(contours):
|
263 |
doc = ezdxf.new()
|
264 |
msp = doc.modelspace()
|
@@ -374,7 +357,7 @@ def predict(image, offset_inches):
|
|
374 |
Image.fromarray(dilated_mask).save("./outputs/scaled_mask_new.jpg")
|
375 |
outlines, contours = extract_outlines(dilated_mask)
|
376 |
shrunked_img_contours = cv2.drawContours(
|
377 |
-
|
378 |
)
|
379 |
dxf = save_dxf_spline(contours, scaling_factor, processed_size[0])
|
380 |
|
|
|
242 |
return cropped_image
|
243 |
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
def to_dxf(contours):
|
246 |
doc = ezdxf.new()
|
247 |
msp = doc.modelspace()
|
|
|
357 |
Image.fromarray(dilated_mask).save("./outputs/scaled_mask_new.jpg")
|
358 |
outlines, contours = extract_outlines(dilated_mask)
|
359 |
shrunked_img_contours = cv2.drawContours(
|
360 |
+
image, contours, -1, (0, 0, 255), thickness=2
|
361 |
)
|
362 |
dxf = save_dxf_spline(contours, scaling_factor, processed_size[0])
|
363 |
|