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

ccalib/omnidir: bad results with projectPoints / undistortPoints for non-contiguous inputs #3625

Open
4 tasks done
gautiervarjo opened this issue Jan 19, 2024 · 0 comments
Open
4 tasks done

Comments

@gautiervarjo
Copy link

System information (version)
  • OpenCV => 4.5, 4.8, 4.9 (versions I tried)
  • Operating System / Platform => Linux x86_64
  • Compiler => unknown (installed opencv-contrib-python from PyPI)
Detailed description

When using the functions cv2.omnidir.projectPoints and cv2.omnidir.undistortPoints via the python API, the results might be garbage depending on how the input points were sliced and reshaped.

If the input numpy array is copied, the issue disappears.

Steps to reproduce
import cv2
import numpy as np

# Dummy camera parameters.
K = np.array([[500.0, 0.0, 500.0], [0.0, 500.0, 500.0], [0.0, 0.0, 1.0]])
D = (0.0, 0.0, 0.0, 0.0)
Xi = np.array(0.0)
R = np.eye(3)

# Generate a bunch of 2D points, with an extra 3rd channel which we'll slice away.
rng = np.random.default_rng(seed=1234)
points = rng.uniform(0, 1000, size=(6, 3))

np.testing.assert_allclose(
    cv2.omnidir.undistortPoints(points[:, :2].reshape(-1, 1, 2), K, D, Xi, R),
    cv2.omnidir.undistortPoints(points[:, :2].reshape(-1, 1, 2).copy(), K, D, Xi, R),
    atol=1e-6,
    rtol=1e-6,
)
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
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

No branches or pull requests

1 participant