Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fixed docstring and export as xml dim bug #586

Merged
merged 2 commits into from
Nov 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
apply changes
  • Loading branch information
Felix committed Nov 5, 2021
commit 8af56dba29d7a54e74a33e6dc6f405361ac9b523
10 changes: 5 additions & 5 deletions doctr/utils/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def rect_patch(

Args:
geometry: bounding box of the element
page_dimensions: dimensions of the Page
page_dimensions: dimensions of the Page in format (height, width)
label: label to display when hovered
color: color to draw box
alpha: opacity parameter to fill the boxes, 0 = transparent
Expand Down Expand Up @@ -80,7 +80,7 @@ def polygon_patch(

Args:
geometry: bounding box of the element
page_dimensions: dimensions of the Page
page_dimensions: dimensions of the Page in format (height, width)
label: label to display when hovered
color: color to draw box
alpha: opacity parameter to fill the boxes, 0 = transparent
Expand Down Expand Up @@ -121,7 +121,7 @@ def create_obj_patch(

Args:
geometry: bounding box (straight or rotated) of the element
page_dimensions: dimensions of the page
page_dimensions: dimensions of the page in format (height, width)

Returns:
a matplotlib Patch
Expand Down Expand Up @@ -273,8 +273,8 @@ def synthesize_page(
for word in line["words"]:
# Get aboslute word geometry
(xmin, ymin), (xmax, ymax) = word["geometry"]
xmin, xmax = int(w * xmin), int(w * xmax)
ymin, ymax = int(h * ymin), int(h * ymax)
xmin, xmax = int(round(w * xmin)), int(round(w * xmax))
ymin, ymax = int(round(h * ymin)), int(round(h * ymax))

# White drawing context adapted to font size, 0.75 factor to convert pts --> pix
font = get_font(font_family, int(0.75 * (ymax - ymin)))
Expand Down