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

Fix coordinate conversion for Unstructured ocr_only partitioning strategy #108

Open
bsowell opened this issue Oct 15, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@bsowell
Copy link
Contributor

bsowell commented Oct 15, 2023

There are some quirks with the ocr_only partitioning strategy in unstructured. The expectation in general is that bounding box coordinates are reported counter-clockwise starting at the top-left corner. Since the y-axis increases going down, this means that the second and third points should have higher y-values than the first and last points. This was true for the fast partitioning strategy, but does not appear to always be the case for ocr_only. For example, this are coordinates reported in one case:

{
  "layout_height": 1500,
  "layout_width": 2667,
  "points": [
    [173.0, 1337.0],
    [173.0, 1182.0],
    [2548.0, 1182.0],
    [2548.0, 1337.0]
  ],
  "system": "PixelSpace"
}

You can see here that the points are reported starting at the lower left, and going clockwise. The OCR code in unstructured appears to be undergoing a fairly significant refactoring, so this may be actively changing, but in the meantime, we should make our bounding box conversion behave correctly in this case.

@bsowell bsowell added the bug Something isn't working label Oct 15, 2023
@bsowell
Copy link
Contributor Author

bsowell commented Oct 23, 2023

This was independently reported in the unstructured repo at Unstructured-IO/unstructured#1792

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant