From bff7dcce1ac2c6959e169451b7a4a954565b8d7d Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 15 Aug 2020 21:39:51 +0200 Subject: [PATCH] Don't raise exception for empty intersection (fix issue #139) Signed-off-by: Stefan Weil --- ocrd_tesserocr/segment_region.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocrd_tesserocr/segment_region.py b/ocrd_tesserocr/segment_region.py index df5e1ec..c2114f4 100644 --- a/ocrd_tesserocr/segment_region.py +++ b/ocrd_tesserocr/segment_region.py @@ -325,7 +325,8 @@ def polygon_for_parent(polygon, parent): interp = childp.intersection(parentp) if interp.is_empty: # FIXME: we need a better strategy against this - raise Exception("intersection of would-be segment with parent is empty") + LOG.error("intersection of would-be segment with parent is empty") + return polygon if interp.type == 'MultiPolygon': interp = interp.convex_hull return interp.exterior.coords[:-1] # keep open