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

segment-region: clip polygons to parent... #128

Merged
merged 2 commits into from
Jun 5, 2020

Conversation

bertsky
Copy link
Collaborator

@bertsky bertsky commented May 20, 2020

(before annotating polygon coordinates, ensure they fit
into their parent if it exists, or the page frame otherwise)

This happens for example when the page was deskewed and the region is already on the edge of the (rotated, enlarged) page frame. So the result would be syntactically invalid.

This is another (previously undetected) instance of OCR-D/core#489, with the same solution.

@codecov
Copy link

codecov bot commented May 20, 2020

Codecov Report

Merging #128 into master will decrease coverage by 0.14%.
The diff coverage is 35.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #128      +/-   ##
==========================================
- Coverage   36.28%   36.13%   -0.15%     
==========================================
  Files           9        9              
  Lines         995     1010      +15     
  Branches      219      224       +5     
==========================================
+ Hits          361      365       +4     
- Misses        567      575       +8     
- Partials       67       70       +3     
Impacted Files Coverage Δ
ocrd_tesserocr/segment_region.py 52.66% <35.29%> (-2.23%) ⬇️
ocrd_tesserocr/recognize.py 46.60% <0.00%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfd29aa...0bbd5b5. Read the comment docs.

def polygon_for_parent(polygon, parent):
"""Clip polygon to parent polygon range.

(Should be moved to ocrd_utils.coordinates_for_segment.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

(before annotating polygon coordinates, ensure they fit
 into their parent if it exists, or the page frame otherwise)
@bertsky
Copy link
Collaborator Author

bertsky commented Jun 5, 2020

@kba could you please merge this as well and make another release? (We can take it out again as soon as this is handled by core, but given the many recent and coming changes to the PAGE API, the rewrite will probably be rather large and take more time.)

@kba
Copy link
Member

kba commented Jun 5, 2020

Sure

@kba kba merged commit 0bbd5b5 into OCR-D:master Jun 5, 2020
@bertsky bertsky deleted the fix-polygon-for-parent branch August 12, 2020 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants