Skip to content

Commit

Permalink
Robustness improvement in extract_polygonal_environment()
Browse files Browse the repository at this point in the history
Fixes #606
  • Loading branch information
mittagessen committed May 23, 2024
1 parent d983d48 commit 8003dc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kraken/lib/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,8 @@ def extract_polygons(im: Image.Image,
for line in bounds.lines:
if line.boundary is None:
raise KrakenInputException('No boundary given for line')

This comment has been minimized.

Copy link
@PonteIneptique

PonteIneptique May 23, 2024

Contributor

Given those raise not being in Try / except, don't we risk the full polygonization being broken for a single wrong line ? (I am unsure about this statement, I just so the diff which made me react.)

This comment has been minimized.

Copy link
@mittagessen

mittagessen via email May 23, 2024

Author Owner
if len(line.baseline) < 2 or geom.LineString(line.baseline).length < 5:
raise KrakenInputException('Baseline length below minimum 5px')
pl = np.array(line.boundary)
baseline = np.array(line.baseline)
c_min, c_max = int(pl[:, 0].min()), int(pl[:, 0].max())
Expand Down

0 comments on commit 8003dc0

Please sign in to comment.