From b92501faf62fa6f35e7d200f36720d303c681f63 Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Mon, 24 Oct 2022 15:43:01 +0800 Subject: [PATCH] fix pic (#8067) --- README.md | 2 +- README_ch.md | 2 +- ppocr/utils/visual.py | 8 +++++--- ppstructure/README.md | 2 +- ppstructure/README_ch.md | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b8996346..5f85aaaa 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ PaddleOCR support a variety of cutting-edge algorithms related to OCR, and devel - SER (Semantic entity recognition)
- +
diff --git a/README_ch.md b/README_ch.md index f7338c07..8e1cfeac 100755 --- a/README_ch.md +++ b/README_ch.md @@ -222,7 +222,7 @@ PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力
- +
- RE(关系提取) diff --git a/ppocr/utils/visual.py b/ppocr/utils/visual.py index 5bd805ea..b6de4465 100644 --- a/ppocr/utils/visual.py +++ b/ppocr/utils/visual.py @@ -51,20 +51,22 @@ def draw_ser_results(image, bbox = trans_poly_to_bbox(ocr_info["points"]) draw_box_txt(bbox, text, draw, font, font_size, color) - img_new = Image.blend(image, img_new, 0.5) + img_new = Image.blend(image, img_new, 0.7) return np.array(img_new) def draw_box_txt(bbox, text, draw, font, font_size, color): + # draw ocr results outline bbox = ((bbox[0], bbox[1]), (bbox[2], bbox[3])) draw.rectangle(bbox, fill=color) # draw ocr results - start_y = max(0, bbox[0][1] - font_size) tw = font.getsize(text)[0] + th = font.getsize(text)[1] + start_y = max(0, bbox[0][1] - th) draw.rectangle( - [(bbox[0][0] + 1, start_y), (bbox[0][0] + tw + 1, start_y + font_size)], + [(bbox[0][0] + 1, start_y), (bbox[0][0] + tw + 1, start_y + th)], fill=(0, 0, 255)) draw.text((bbox[0][0] + 1, start_y), text, fill=(255, 255, 255), font=font) diff --git a/ppstructure/README.md b/ppstructure/README.md index 9d503ca8..e44ba588 100644 --- a/ppstructure/README.md +++ b/ppstructure/README.md @@ -62,7 +62,7 @@ The following figure shows the effect of layout recovery based on the results of Different colored boxes in the figure represent different categories.
- +
diff --git a/ppstructure/README_ch.md b/ppstructure/README_ch.md index 050740b3..53c251d1 100644 --- a/ppstructure/README_ch.md +++ b/ppstructure/README_ch.md @@ -78,7 +78,7 @@ PP-StructureV2支持各个模块独立使用或灵活搭配,如,可以单独
- +
-- GitLab