Skip to content

fix(ocr): enclose all Google Vision paragraph vertices - #4825

Draft
Afloat16 wants to merge 1 commit into
Unstructured-IO:mainfrom
Afloat16:Afloat16/google-vision-rotated-bounds-20261121
Draft

Afloat16 wants to merge 1 commit into
Unstructured-IO:mainfrom
Afloat16:Afloat16/google-vision-rotated-bounds-20261121

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Google Vision returns paragraph vertices in text-relative order. Vertices 0 and 2 are therefore not necessarily the upper-left and lower-right corners in image coordinates. Using only those vertices crops diagonally rotated text and reverses the bounds of 180-degree text.

Construct the axis-aligned region from the minimum and maximum x/y over all vertices, retaining the existing text and source metadata. The provider documents the rotation-dependent vertex order in its bounding-box contract.

Validation

  • Real Google Vision protobuf annotations cover two angled rectangles, a 180-degree rectangle and an axis-aligned control, including zero-valued coordinates.
  • Base revision: 3 failures, 1 pass. Final: 4 passed, using actual TextRegions construction.
  • No service requests or credentials are used in tests.
  • Repository Ruff 0.15.10 lint and format checks pass.

Draft pending the full repository test gate.

Checklist

  • Conventional user-facing title.
  • Maintainer: apply the appropriate category label.
  • Full repository test gate.

This branch has not been deployed

No deployments
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.

1 participant