Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
49d1a595
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1520
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
49d1a595
编写于
7月 17, 2023
作者:
livingbody
提交者:
GitHub
7月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upgrade pillow to 10.0.0 (#10405)
上级
cd5d0134
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
14 addition
and
10 deletion
+14
-10
StyleText/engine/text_drawers.py
StyleText/engine/text_drawers.py
+2
-1
applications/PCB字符识别/gen_data/gen.py
applications/PCB字符识别/gen_data/gen.py
+4
-2
ppocr/data/imaug/rec_img_aug.py
ppocr/data/imaug/rec_img_aug.py
+1
-1
ppocr/utils/visual.py
ppocr/utils/visual.py
+2
-2
ppstructure/utility.py
ppstructure/utility.py
+2
-1
requirements.txt
requirements.txt
+1
-1
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+1
-1
tools/infer/utility.py
tools/infer/utility.py
+1
-1
未找到文件。
StyleText/engine/text_drawers.py
浏览文件 @
49d1a595
...
...
@@ -23,7 +23,8 @@ class StdTextDrawer(object):
def
get_valid_height
(
self
,
font_path
):
font
=
ImageFont
.
truetype
(
font_path
,
self
.
height
-
4
)
_
,
font_height
=
font
.
getsize
(
self
.
char_list
)
left
,
top
,
right
,
bottom
=
font
.
getbbox
(
self
.
char_list
)
_
,
font_height
=
right
-
left
,
bottom
-
top
if
font_height
<=
self
.
height
-
4
:
return
self
.
height
-
4
else
:
...
...
applications/PCB字符识别/gen_data/gen.py
浏览文件 @
49d1a595
...
...
@@ -55,7 +55,8 @@ def get_horizontal_text_picture(image_file, chars, fonts_list, cf):
ch_w
=
[]
ch_h
=
[]
for
ch
in
chars
:
wt
,
ht
=
font
.
getsize
(
ch
)
left
,
top
,
right
,
bottom
=
font
.
getbbox
(
ch
)
wt
,
ht
=
right
-
left
,
bottom
-
top
ch_w
.
append
(
wt
)
ch_h
.
append
(
ht
)
f_w
=
sum
(
ch_w
)
...
...
@@ -101,7 +102,8 @@ def get_vertical_text_picture(image_file, chars, fonts_list, cf):
ch_w
=
[]
ch_h
=
[]
for
ch
in
chars
:
wt
,
ht
=
font
.
getsize
(
ch
)
left
,
top
,
right
,
bottom
=
font
.
getbbox
(
ch
)
wt
,
ht
=
right
-
left
,
bottom
-
top
ch_w
.
append
(
wt
)
ch_h
.
append
(
ht
)
f_w
=
max
(
ch_w
)
...
...
ppocr/data/imaug/rec_img_aug.py
浏览文件 @
49d1a595
...
...
@@ -406,7 +406,7 @@ class GrayRecResizeImg(object):
def
__init__
(
self
,
image_shape
,
resize_type
,
inter_type
=
'Image.
ANTIALIA
S'
,
inter_type
=
'Image.
LANCZO
S'
,
scale
=
True
,
padding
=
False
,
**
kwargs
):
...
...
ppocr/utils/visual.py
浏览文件 @
49d1a595
...
...
@@ -62,8 +62,8 @@ def draw_box_txt(bbox, text, draw, font, font_size, color):
draw
.
rectangle
(
bbox
,
fill
=
color
)
# draw ocr results
tw
=
font
.
getsize
(
text
)[
0
]
t
h
=
font
.
getsize
(
text
)[
1
]
left
,
top
,
right
,
bottom
=
font
.
getbbox
(
text
)
t
w
,
th
=
right
-
left
,
bottom
-
top
start_y
=
max
(
0
,
bbox
[
0
][
1
]
-
th
)
draw
.
rectangle
(
[(
bbox
[
0
][
0
]
+
1
,
start_y
),
(
bbox
[
0
][
0
]
+
tw
+
1
,
start_y
+
th
)],
...
...
ppstructure/utility.py
浏览文件 @
49d1a595
...
...
@@ -132,7 +132,8 @@ def draw_structure_result(image, result, font_path):
[(
box_layout
[
0
],
box_layout
[
1
]),
(
box_layout
[
2
],
box_layout
[
3
])],
outline
=
box_color
,
width
=
3
)
text_w
,
text_h
=
font
.
getsize
(
region
[
'type'
])
left
,
top
,
right
,
bottom
=
font
.
getbbox
(
region
[
'type'
])
text_w
,
text_h
=
right
-
left
,
bottom
-
top
draw_layout
.
rectangle
(
[(
box_layout
[
0
],
box_layout
[
1
]),
(
box_layout
[
0
]
+
text_w
,
box_layout
[
1
]
+
text_h
)],
...
...
requirements.txt
浏览文件 @
49d1a595
...
...
@@ -15,4 +15,4 @@ premailer
openpyxl
attrdict
PyMuPDF
<1.21.0
Pillow
<=9.5
.0
Pillow
>=10.0
.0
tools/infer/predict_rec.py
浏览文件 @
49d1a595
...
...
@@ -156,7 +156,7 @@ class TextRecognizer(object):
if
self
.
rec_algorithm
==
'ViTSTR'
:
img
=
image_pil
.
resize
([
imgW
,
imgH
],
Image
.
BICUBIC
)
else
:
img
=
image_pil
.
resize
([
imgW
,
imgH
],
Image
.
ANTIALIA
S
)
img
=
image_pil
.
resize
([
imgW
,
imgH
],
Image
.
LANCZO
S
)
img
=
np
.
array
(
img
)
norm_img
=
np
.
expand_dims
(
img
,
-
1
)
norm_img
=
norm_img
.
transpose
((
2
,
0
,
1
))
...
...
tools/infer/utility.py
浏览文件 @
49d1a595
...
...
@@ -471,7 +471,7 @@ def draw_box_txt_fine(img_size, box, txt, font_path="./doc/fonts/simfang.ttf"):
def
create_font
(
txt
,
sz
,
font_path
=
"./doc/fonts/simfang.ttf"
):
font_size
=
int
(
sz
[
1
]
*
0.99
)
font
=
ImageFont
.
truetype
(
font_path
,
font_size
,
encoding
=
"utf-8"
)
length
=
font
.
get
size
(
txt
)[
0
]
length
=
font
.
get
length
(
txt
)
if
length
>
sz
[
0
]:
font_size
=
int
(
font_size
*
sz
[
0
]
/
length
)
font
=
ImageFont
.
truetype
(
font_path
,
font_size
,
encoding
=
"utf-8"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录