From 70bdea2eaeb955517cca6edaff32d27bfdec58b4 Mon Sep 17 00:00:00 2001 From: "Seven.Hsu" Date: Fri, 13 Aug 2021 17:21:11 +0800 Subject: [PATCH] fix: cy-c>cy+c if cp_section[-1]==[0,0], make last cy-c>cy+c. The final poly will be screwed --- craft_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/craft_utils.py b/craft_utils.py index 43c1357..988b8b6 100755 --- a/craft_utils.py +++ b/craft_utils.py @@ -165,7 +165,7 @@ def getPoly_core(boxes, labels, mapper, linkmap): polys.append(None); continue # calc median maximum of pivot points - half_char_h = np.median(seg_height) * expand_ratio / 2 + half_char_h = max_len / 2 # np.median(seg_height) * expand_ratio / 2 # calc gradiant and apply to make horizontal pivots new_pp = [] @@ -176,7 +176,7 @@ def getPoly_core(boxes, labels, mapper, linkmap): new_pp.append([x, cy - half_char_h, x, cy + half_char_h]) continue rad = - math.atan2(dy, dx) - c, s = half_char_h * math.cos(rad), half_char_h * math.sin(rad) + c, s = abs(half_char_h * math.cos(rad)), half_char_h * math.sin(rad) new_pp.append([x - s, cy - c, x + s, cy + c]) # get edge points to cover character heatmaps