Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
87525e99
authored
2021-11-11 17:39:59 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix afc e-contract
1 parent
9bab1769
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
src/common/electronic_afc_contract/afc_contract_ocr.py
src/common/electronic_afc_contract/get_char.py
src/common/electronic_afc_contract/afc_contract_ocr.py
View file @
87525e9
...
...
@@ -9,8 +9,23 @@ from .get_char import Finder
def
predict
(
pdf_info
):
ocr_results
=
{}
for
pno
in
pdf_info
:
ocr_results
[
pno
]
=
{}
for
key
,
block
in
enumerate
(
pdf_info
[
pno
][
'blocks'
]):
if
block
[
'type'
]
!=
0
:
continue
for
line
in
block
[
'lines'
]:
for
span
in
line
[
'spans'
]:
bbox
,
text
=
span
[
'bbox'
],
span
[
'text'
]
# print(text)
xmin
,
ymin
,
xmax
,
ymax
=
bbox
polygon
=
[
xmin
,
ymin
,
xmax
,
ymin
,
xmax
,
ymax
,
xmin
,
ymax
]
text
=
text
.
replace
(
":"
,
":"
)
.
replace
(
" "
,
""
)
ocr_results
[
pno
][
key
]
=
[
polygon
,
text
]
# 输入是整个 PDF 中的信息
f
=
Finder
(
pdf_info
)
f
=
Finder
(
pdf_info
,
ocr_results
=
ocr_results
)
results
=
f
.
get_info
()
return
results
...
...
src/common/electronic_afc_contract/get_char.py
View file @
87525e9
This diff is collapsed.
Click to expand it.
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment