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
133b0683
authored
2022-05-06 16:07:44 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix hil contract
1 parent
ce95c8f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
src/common/electronic_hil_contract/get_char.py
src/common/electronic_hil_contract/get_char.py
View file @
133b068
...
...
@@ -8,6 +8,26 @@
import
re
import
numpy
as
np
from
fuzzywuzzy
import
fuzz
from
shapely.geometry
import
Polygon
def
caculate_iou
(
g
,
p
):
g
=
Polygon
(
np
.
array
(
g
)
.
reshape
((
-
1
,
2
)))
p
=
Polygon
(
np
.
array
(
p
)
.
reshape
((
-
1
,
2
)))
inter
=
Polygon
(
g
)
.
intersection
(
Polygon
(
p
))
.
area
union
=
g
.
area
+
p
.
area
-
inter
return
inter
/
union
def
get_table_info
(
bbox_1
,
bbox_2
,
ocr_result
):
anchor
=
[
bbox_2
[
0
],
bbox_1
[
1
],
bbox_2
[
2
],
bbox_1
[
3
],
bbox_2
[
4
],
bbox_1
[
5
],
bbox_2
[
6
],
bbox_1
[
7
]]
table_info
=
''
for
span
in
ocr_result
:
iou
=
caculate_iou
(
anchor
,
span
[
0
])
if
iou
>
0
:
table_info
=
span
[
1
]
return
table_info
class
Finder
:
...
...
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