Skip to content

Commit d5321f8

Browse files
committed
add check for empty polygon in line removal method
1 parent 6cc0572 commit d5321f8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

topo_map_processor/processor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ def remove_line(self, line, map_img, removal_params):
492492
#cv2.imwrite('temp.jpg', img_strip)
493493

494494
line_poly_t = translate(line_poly, xoff=-bb[0], yoff=-bb[1])
495+
# if empty then nothing to do
496+
if line_poly_t.is_empty:
497+
print('line poly empty, nothing to do')
498+
return
495499
mask = np.zeros(img_strip.shape[:2], dtype=np.uint8)
496500
poly_coords = np.array([ [int(x[0]), int(x[1])] for x in line_poly_t.exterior.coords ])
497501
cv2.fillPoly(mask, pts=[poly_coords], color=1)

0 commit comments

Comments
 (0)