Open senyai opened 1 month ago
I have found one of the roots of this issue:
https://github.com/kornia/kornia/blob/969169bc2aebc14f5c82abdefd3c85c3d31b62f0/kornia/geometry/conversions.py#L1037-L1038
if you subtract 1 from width you get incorrect transformation. After removing -1
my testcase showed correct output. Alas, when passing align_corners=False
that transformation is still incorrect, but 0.5 pixels incorrect, and not 1.5 pixels incorrect 👍🏻
Thank you @senyai for your input. We really appreciate your interest in using Kornia.
To ensure we can best support you and other contributors, we'd like to kindly suggest a few channels for future inquiries (also see here:
#kornia
tag there: PyTorch DiscussThese channels help us maintain organized and efficient communication.
Looking forward to seeing you in one of these spaces or in other issues you encounter of course!
Describe the bug
Hello! This is my first time with kornia. I started with
homography_warp
function. Let's say I have an image of size 8x16 and I want to flip it with this function. Not because I want to flip an image, but because I want to understand the math behind it.To flip an image along Y axis I used this matrix:
Unfortunately the output image is not only flipped, but also shifted 1px:
Reproduction steps
Expected behavior
And if I replace "8" with "7", I see 99.99% correct image. My assumption is that top left pixel's top left corner has coordinates (0,0) and bottom right corner of that pixel has coordinates (1,1). If that is correct, then my initial flip matrix is correct and there's a bug. If that assumption is incorrect, then coordinate system should be mentioned in the documentation.
Environment
Additional context
No response