Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
part_of_F3_OCR
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
49ae7448
authored
2022-09-07 19:00:22 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix dealername4
1 parent
41cd5169
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
authorization_from/const.py
authorization_from/retriever.py
authorization_from/const.py
View file @
49ae744
...
...
@@ -7,7 +7,7 @@ TARGET_FIELD_INDIVIDUALS = {
'value'
:
{
'姓名'
:
(
'under'
,
{
'left_padding'
:
1
,
'right_padding'
:
1
,
'scope'
:
2
},
''
),
'个人身份证件号码'
:
(
'under'
,
{
'left_padding'
:
0.5
,
'right_padding'
:
0.5
,
'scope'
:
2
},
''
),
'经销商名称'
:
(
'under'
,
{
'left_padding'
:
0.1
,
'right_padding'
:
0.
1
,
'scope'
:
2
},
''
)
'经销商名称'
:
(
'under'
,
{
'left_padding'
:
0.1
,
'right_padding'
:
0.
5
,
'scope'
:
2
,
'append'
:
True
},
''
)
},
'signature'
:
{
'签字'
:
{
'signature'
,
}
...
...
authorization_from/retriever.py
View file @
49ae744
...
...
@@ -92,7 +92,7 @@ class Retriever:
return
value
,
coordinates
@staticmethod
def
value_under
(
go_res
,
key_coordinates
,
left_padding
,
right_padding
,
scope
,
value_type
=
None
):
def
value_under
(
go_res
,
key_coordinates
,
left_padding
,
right_padding
,
scope
,
value_type
=
None
,
append
=
False
):
# 字段值查找方向:下方
width
=
key_coordinates
[
2
]
-
key_coordinates
[
0
]
x_min
=
key_coordinates
[
0
]
-
(
width
*
left_padding
)
...
...
@@ -102,19 +102,23 @@ class Retriever:
y_min
=
key_coordinates
[
-
1
]
y_max
=
key_coordinates
[
-
1
]
+
(
height
*
scope
)
y_min_find
=
None
value
=
None
coordinates
=
None
find_list
=
[]
for
(
x0
,
y0
,
_
,
_
,
x1
,
y1
,
_
,
_
),
text
in
go_res
.
values
():
cent_x
=
x0
+
((
x1
-
x0
)
/
2
)
cent_y
=
y0
+
((
y1
-
y0
)
/
2
)
if
x_min
<
cent_x
<
x_max
and
y_min
<
cent_y
<
y_max
:
if
y_min_find
is
None
or
y0
<
y_min_find
:
if
len
(
text
.
strip
())
>
0
:
y_min_find
=
y0
value
=
text
coordinates
=
(
x0
,
y0
,
x1
,
y1
)
return
value
,
coordinates
if
len
(
text
.
strip
())
>
0
:
find_list
.
append
(
cent_x
,
cent_y
,
x0
,
y0
,
x1
,
y1
,
text
)
if
len
(
find_list
)
==
0
:
return
None
,
None
else
:
find_list
.
sort
(
key
=
lambda
x
:
(
x
[
1
],
x
[
0
]))
coordinates
=
find_list
[
0
][
2
:
6
]
if
append
:
value
=
''
.
join
([
text
for
_
,
_
,
_
,
_
,
_
,
_
,
text
in
find_list
])
else
:
value
=
find_list
[
0
][
-
1
]
return
value
,
coordinates
@staticmethod
def
rebuild_res
(
value_res
,
coordinates_res
,
is_signature
=
False
):
...
...
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