Correcting lens distortion during camera calibration

14 views (last 30 days)
Hello,
I am attempting to calibrate several webcams for optical tracking using Matlab's cameraCalibrator tool. Following the instructions via the help guide, I was able to obtain the camera's parameters, including the radial distortion coefficients as follows:
k=[-0.0548 0.2001 -0.3073]
I encounter an issue however, when I plug these values into the distortion correction equations along with any set of (x_d,y_d) coordinates:
x_d = x(1 + k1*r^2 + k2*r^4 + k3*r^6)
y_d= y(1 + k1*r^2 + k2*r^4 + k3*r^6)
where r^2 = x^2 + y^2
Analyzing this pair of nonlinear equations, you quickly discover that in order to get any (x,y) values that are on the magnitude of our image (1280x720 --> +-640, +-360) you either need really small k values (on the order of e^-10) or you need to multiply your (x,y) coordinates by some scalar to make them smaller.
I am comfortable assuming Matlab's radial distortion coefficients (k, listed above) are accurate, because all the other intrinsic/extrinsic data the cameraCalibrator tool provided was correct. This leads me to ask the question: do I need to normalize the image coordinates somehow and if so, how do I do that?
Thank you for your help
-Alex

Accepted Answer

Dima Lisin
Dima Lisin on 4 Aug 2014
Edited: Dima Lisin on 10 Aug 2014
Hi Alex,
Yes, the x and y distortion equations are in the normalized image coordinates. That is the origin is at the optical center (aka principal point), and the coordinates are in world units. So if you have a point in pixels, you need to subtract the optical center, and then divide by fx and fy from the intrinsic matrix.
Also, as a sanity check you should always try using undistortImage() to see whether the distortion coefficients make sense. There is a button in the buttom left corner of the image pane of the Camera Calibrator that will show you the undistorted image.

More Answers (0)

Categories

Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!