Skip to content

[utils] Rotate integer points and boxes with a float rotation matrix - #2193

Merged
felixdittrich92 merged 1 commit into
mindee:mainfrom
RavSinghChandan:rotate-integer-coordinates
Oct 30, 2026
Merged

felixdittrich92 merged 1 commit into
mindee:mainfrom
RavSinghChandan:rotate-integer-coordinates

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

rotate_abs_points and rotate_boxes built the rotation matrix with the dtype of the input. For integer coordinates, the cosine and sine were truncated to 0 or 1, so rotate_abs_points(np.array([[10, 0]]), 30) returned [[0, 0]] and rotate_boxes(np.array([[0, 0, 1, 1]]), 30, (1, 1)) collapsed the box onto the page center.

The matrix is now built in floating point (the input dtype when it is already a float one, so float32 and float64 results are unchanged), and rotate_boxes converts the boxes to floating point before rotating them

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.74%. Comparing base (b14dd36) to head (e181ace).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2193   +/-   ##
=======================================
  Coverage   97.74%   97.74%           
=======================================
  Files         170      170           
  Lines       10961    10961           
=======================================
  Hits        10714    10714           
  Misses        247      247           
Flag Coverage Δ
unittests 97.74% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@felixdittrich92 felixdittrich92 self-assigned this Oct 30, 2026
@felixdittrich92 felixdittrich92 added this to the 1.2.0 milestone Oct 30, 2026
@felixdittrich92 felixdittrich92 added type: enhancement Improvement module: utils Related to doctr.utils ext: tests Related to tests folder labels Oct 30, 2026

@felixdittrich92 felixdittrich92 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @RavSinghChandan 👍

@felixdittrich92
felixdittrich92 merged commit 296b66a into mindee:main Oct 30, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext: tests Related to tests folder module: utils Related to doctr.utils type: enhancement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants