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

Rotation correction does not work as expected #133

Open
MrinalJain17 opened this issue Apr 1, 2023 · 2 comments
Open

Rotation correction does not work as expected #133

MrinalJain17 opened this issue Apr 1, 2023 · 2 comments
Labels
python Relates to the Python version of TRP

Comments

@MrinalJain17
Copy link

Are there plans to fix this issue:

# FIXME: add dimension. the relative scale messes up the new coordinates, have to use the actual image scale

I've noticed that the corrections applied align well when the document/image is rotated at right angles (90, 180, ...). But otherwise, the transformed geometries don't line up.

@schadem
Copy link
Contributor

schadem commented Apr 3, 2023

It is not scheduled yet, but gladly accept PRs that handle the rotation better.

@MrinalJain17
Copy link
Author

I can give it a shot, but will need some help.

As far as I understand, this is the issue:

  • The current geometry rotation (bounding box and polygons) applies the rotation along some center.
  • The document (image) when rotated generally is allowed to "expand". This rotated document image is now a plane that is misaligned with that of the geometry (bounding boxes, polygons).
  • This only occurs when the rotation is performed at non-right angles.

I have been looking into ways to tackle this, but haven't found much literature. Maybe something like PyTorch is doing - https://github.com/pytorch/vision/blob/781f512b01bc2324d7fdd11f0901f60571fc476f/torchvision/transforms/v2/functional/_geometry.py#L883

@schadem Do you happen to know if there exists some blog or something that can explain the potential solution in a better way?

@athewsey athewsey added the python Relates to the Python version of TRP label Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Relates to the Python version of TRP
Projects
None yet
Development

No branches or pull requests

3 participants