Ask Your Question
0

How to rescale distortion coefficients for mm unit into OpenCV ones

asked 2014-10-30 03:45:09 -0600

From the OpenCV documentation I understand that pixel is the unit used to process the distortion effects induced by imperfect objective. As an example in the camera matrix the focal lens must be given in pixel. On the other hand, I need to use the distortion coefficients k1,k2,p1,p2,k3 provided by the commercial software iWitness for further image processing by means OpenCV. The unit used in iWitness is mm, so that typically k1 is about 1e-04. This mean that Dx = k1r^3, for r=10 mm is 0.1 mm.

I tried to rescale the coefficients to be applied in distance in pixel, that is

k1_OpenCv = k1_iWitness*px_dimension^2, but I get very small k1 value. As an example for Nikon D800, px_dimension = 4.9e-03 mm, so that k1_OpenCV = 2.4e-09 that is much smaller than the values reported by many users, like 0.1.

Looking at the source of cv::initUndistortRectifyMap it seems that x,y are, in a quite complicated manne,r normalized to size.width size.height respectively. Probably this is the key of the problem, but how to do that correctly?

How to transform (k1,k2,p1,p2,k3)_iWitness in (k1,k2,p1,p2,k3)_OpenCV?

Thanks for any help.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-11-06 07:45:54 -0600

Ok perhaps I found the solution: according to the formulae shown in "Camera Calibration and 3D Reconstruction" at OpenCV documentation, the distortion coefficients are applied to dimensionless quantity; in the end the corrected value is multiply to the focal length f. Therefore, to be used in OpenCV, a correction-coefficient set for millimetre distances should be re-scaled as following: k1=k1mmf^2 k2=k2mmf^4 k3=k3mmf^6 p1=p1mmf p2=p2mm*f

In this way by the undistort function I get pretty images well corrected for distortion.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-30 03:45:09 -0600

Seen: 1,312 times

Last updated: Nov 06 '14