OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Mon, 28 Sep 2020 06:52:33 -0500Camera/Distortion Model Confusionhttp://answers.opencv.org/question/234367/cameradistortion-model-confusion/Hello People,
so i'm doing some augmented reality Stuff and to do this properly i need to calibrate my camera. Calibration works fine so far, but i'm confused by the camera models used. As of my understandig, OpenCV uses a pixel based model, so the image plane has a size of 1920x1080 i.e. and focal length is also measured in px. I can convert that to real-world units using the pixel/mm relation of the sensor, wich checks out good. So the converted OpenCV focal length matches the focal length given on the lens closely.
However, i'm struggeling with the distortion. I know that OpenCV uses this formula for distortion correction:
Xc = Xd*(1+K1*r^2+K2*r^4...) with r=sqrt(x^2+y^2)
But what range are Xc and Xd in? Pixels, mm(sensorsize) oder uv?
Also, there is another model, used by some mediaservers & photogrammetry programs wich uses significant smaller coefficients for k1-k3, they can be obtained from the openCV coefficients by this formula:
K1 = K1(openCV)/fx(mm)^2
K2 = K2(openCV)/fx(mm)^4
K3 = K3(openCV)/fx(mm)^6
I dont really have found that much information on this model, except this: https://www.photomodeler.com/downloads/OnlineHelp/index.html#!radiallensdistortion.htm
But here they are using basically the same formula for lens distortion, so why the different coefficients?
Any links,papers or explanations are very much appreciated.
Thank you and greetings,
PatrickThu, 27 Aug 2020 05:04:40 -0500http://answers.opencv.org/question/234367/cameradistortion-model-confusion/Comment by Scheolin for <p>Hello People,</p>
<p>so i'm doing some augmented reality Stuff and to do this properly i need to calibrate my camera. Calibration works fine so far, but i'm confused by the camera models used. As of my understandig, OpenCV uses a pixel based model, so the image plane has a size of 1920x1080 i.e. and focal length is also measured in px. I can convert that to real-world units using the pixel/mm relation of the sensor, wich checks out good. So the converted OpenCV focal length matches the focal length given on the lens closely. </p>
<p>However, i'm struggeling with the distortion. I know that OpenCV uses this formula for distortion correction:</p>
<p>Xc = Xd<em>(1+K1</em>r^2+K2*r^4...) with r=sqrt(x^2+y^2)</p>
<p>But what range are Xc and Xd in? Pixels, mm(sensorsize) oder uv? </p>
<p>Also, there is another model, used by some mediaservers & photogrammetry programs wich uses significant smaller coefficients for k1-k3, they can be obtained from the openCV coefficients by this formula:</p>
<p>K1 = K1(openCV)/fx(mm)^2
K2 = K2(openCV)/fx(mm)^4
K3 = K3(openCV)/fx(mm)^6</p>
<p>I dont really have found that much information on this model, except this: <a href="https://www.photomodeler.com/downloads/OnlineHelp/index.html#!radiallensdistortion.htm">https://www.photomodeler.com/download...</a>
But here they are using basically the same formula for lens distortion, so why the different coefficients?</p>
<p>Any links,papers or explanations are very much appreciated. </p>
<p>Thank you and greetings,</p>
<p>Patrick</p>
http://answers.opencv.org/question/234367/cameradistortion-model-confusion/?comment=235788#post-id-235788Thank you very much, that helped a lot. Sorry for the late answer, couldn't log in :/Mon, 28 Sep 2020 06:52:33 -0500http://answers.opencv.org/question/234367/cameradistortion-model-confusion/?comment=235788#post-id-235788Comment by Eduardo for <p>Hello People,</p>
<p>so i'm doing some augmented reality Stuff and to do this properly i need to calibrate my camera. Calibration works fine so far, but i'm confused by the camera models used. As of my understandig, OpenCV uses a pixel based model, so the image plane has a size of 1920x1080 i.e. and focal length is also measured in px. I can convert that to real-world units using the pixel/mm relation of the sensor, wich checks out good. So the converted OpenCV focal length matches the focal length given on the lens closely. </p>
<p>However, i'm struggeling with the distortion. I know that OpenCV uses this formula for distortion correction:</p>
<p>Xc = Xd<em>(1+K1</em>r^2+K2*r^4...) with r=sqrt(x^2+y^2)</p>
<p>But what range are Xc and Xd in? Pixels, mm(sensorsize) oder uv? </p>
<p>Also, there is another model, used by some mediaservers & photogrammetry programs wich uses significant smaller coefficients for k1-k3, they can be obtained from the openCV coefficients by this formula:</p>
<p>K1 = K1(openCV)/fx(mm)^2
K2 = K2(openCV)/fx(mm)^4
K3 = K3(openCV)/fx(mm)^6</p>
<p>I dont really have found that much information on this model, except this: <a href="https://www.photomodeler.com/downloads/OnlineHelp/index.html#!radiallensdistortion.htm">https://www.photomodeler.com/download...</a>
But here they are using basically the same formula for lens distortion, so why the different coefficients?</p>
<p>Any links,papers or explanations are very much appreciated. </p>
<p>Thank you and greetings,</p>
<p>Patrick</p>
http://answers.opencv.org/question/234367/cameradistortion-model-confusion/?comment=234386#post-id-234386Have a look [here](https://docs.opencv.org/4.4.0/d9/d0c/group__calib3d.html#details). It is in the normalized camera frame (`Z=1`).Thu, 27 Aug 2020 09:00:01 -0500http://answers.opencv.org/question/234367/cameradistortion-model-confusion/?comment=234386#post-id-234386