Fisheye undistortImage and undistortPoints appear inconsistent?

Gman
Fri, 30 Sep 2022 15:07:03 +0000
Python

I have an image with fisheye distortion and the corresponding matrices. When I undistort the image and some known points they shift relative to the image. The only related questions that I can find are from people who don’t provide the Knew/P matrices.

This is a snippet from the result. The top image is the original distorted image with distorted points. The bottom image is the undistorted image with undistorted points.
As you can see the points in the middle are fine, but they get worse further away from the principle point. What am I doing wrong?

Here is the code I use for the undistortions:

undistorted_img = cv2.fisheye.undistortImage(
                distorted=img, K=K, D=d, Knew=K)

undistorted_ip = cv2.fisheye.undistortPoints(
                ip, K=K, D=d, P=K)

I already tried increasing the criteria to

criteria=(cv2.TERM_CRITERIA_COUNT | cv2.TERM_CRITERIA_EPS, 50, 0.03)

but that doesnt help (decreasing it does make it a lot worse).

Any help would be greatly appreciated!

7 posts - 4 participants