I try to determine the distortion of an imaging system. Due to technical reasons, I can only use a grid target. Sample Image of a grid target
I follow the method using cv2 as described here: https://opencv24-python-tutorials.readthedocs.io/en/stable/py_tutorials/py_calib3d/py_calibration/py_calibration.html
Using cv2.findChessboardCorners() does not work. Fair enough, I do not have a checkerboard. BUT I determined the grid points "manually", which works pretty well. Grid points are shown in orange
However, following the code example from cv2, I get this:
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera([objp], [corners], img.shape[::-1], None, None)
with
ret = 403.18434311612924
mtx = [[2.15648501e+04 0.00000000e+00 6.60463129e+02]
[0.00000000e+00 4.83041078e+05 5.08963085e+02]
[0.00000000e+00 0.00000000e+00 1.00000000e+00]]
dist = [[ 2.25904915e+03 6.07202692e-03 2.83113951e+00 -9.49974797e+00 1.69976610e-08]]
rvecs = (array([[-0.59541192],
[-1.49725611],
[-0.56402402]]),)
tvecs = (array([[ 1.2836315e+01],
[-1.8945857e+01],
[ 1.7703286e+04]]),)
Then I try to cv2.undistort() and get a very strange image Undistortion gone wrong
What's wrong here? I do not get any errors.
I tried to artificially distort the image using gimp. Maybe the distortion in the original image is too low to work with. However, the results are also not satisfactory.