Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
37281832
Commit
37281832
authored
Feb 07, 2021
by
littletomatodonkey
Browse files
fix are calc for polygon
parent
895d44bc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
ppocr/data/imaug/make_shrink_map.py
ppocr/data/imaug/make_shrink_map.py
+9
-8
No files found.
ppocr/data/imaug/make_shrink_map.py
View file @
37281832
...
@@ -84,11 +84,12 @@ class MakeShrinkMap(object):
...
@@ -84,11 +84,12 @@ class MakeShrinkMap(object):
return
polygons
,
ignore_tags
return
polygons
,
ignore_tags
def
polygon_area
(
self
,
polygon
):
def
polygon_area
(
self
,
polygon
):
# return cv2.contourArea(polygon.astype(np.float32))
"""
edge
=
0
compute polygon area
for
i
in
range
(
polygon
.
shape
[
0
]):
"""
next_index
=
(
i
+
1
)
%
polygon
.
shape
[
0
]
area
=
0
edge
+=
(
polygon
[
next_index
,
0
]
-
polygon
[
i
,
0
])
*
(
q
=
polygon
[
-
1
]
polygon
[
next_index
,
1
]
-
polygon
[
i
,
1
])
for
p
in
polygon
:
area
+=
p
[
0
]
*
q
[
1
]
-
p
[
1
]
*
q
[
0
]
return
edge
/
2.
q
=
p
return
area
/
2.0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment