问题
I tried to use opencv pinhole model to calculate calibration params and then undistort images. The problem is, there is a strange circle in the undistorted image as below.
The code, original and result images are here:
Any comment will be appreciated.
回答1:
The calibration is a more difficult task than it looks first. I think the main problem is that you show the target in the center of the image only, so the distortion parameters have found this weird parameter optimization. What would be interesting to know is which parameters you allow to optimize and with which flags (there are a lot of parameters that can be found with calibration functions of OpenCV: fx,fy,cx,cy,k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4...).
I would suggest the following:
- Try with more images, in all parts of the screen, if possible remove the image compression which is quite strong in your images.
- Buy adhesive paper, print the target on it and glue it on a piece of glass, forget about the cardboard.
- You can slightly improve the calibration target and the corner detection, look at the documentation of findChessboardCornersSB
.
- Maybe reducing the number of parameters estimated by OpenCV could help to regularize. In my case I set k3 = k4 = k5 = k6 = 0. This is done by providing a vector with zeros for the distortion coefficients (distCoeffs
) and give the flags CALIB_FIX_K3, CALIB_FIX_K4, etc. Look whether some other flags could apply to your system (e.g. CALIB_FIX_ASPECT_RATIO).
来源:https://stackoverflow.com/questions/59538424/opencv-undistortion-image-with-a-strange-circle