# Revision history [back]

### Camera calibration With OpenCV - tutorial

i am reading the tutorial https://docs.opencv.org/3.4.2/d4/d94/tutorial_camera_calibration.html and it seems to me there might be an error in the formulas

xdistorted=x+[2p1xy+p2(r^2+2x^2)]

ydistorted=y+[p1(r^2+2y^2)+2p2xy]

the reason is that the terms p2(r^2+2x^2) and p1(r^2+2y^2)should always be positive no matter what sign of p1 or p2 so i don't know might be the correct formula are

xdistorted=x+[2p1xy+p2^2(r^2+2x^2)]

ydistorted=y+[p1^2(r^2+2y^2)+2p2xy]

for instance if the camera is tilted upwards i might assume p1>0 p2=0

xeffective=x+[2p1xy] (linear correction in x, increasing in half of the plane, decreasing in the other half)

yeffective=y+[p1(r^2+2y^2)] (y always corrected increasing it)

and that would quite work i guess

but i i would really not understand the case camera downwards and p1<0 p2=0 in that case y would be wrongly corrected??!!

am i misunderstanding the formulas??

### Camera calibration With OpenCV - tutorial

i am reading the very interesting tutorial https://docs.opencv.org/3.4.2/d4/d94/tutorial_camera_calibration.html and i find it seems difficult to me there might be an error in understand the formulasformulas for tangential distortion

xdistorted=x+[2p1xy+p2(r^2+2x^2)]

ydistorted=y+[p1(r^2+2y^2)+2p2xy]

the reason is that specifically i don't understand the terms p2(r^2+2x^2) and p1(r^2+2y^2)should p1(r^2+2y^2) which seems to me should have always be positive the same sign no matter what sign of p1 or p2 so i don't know might be p2, in all 4 areas of the correct formula areCartesian plane

xdistorted=x+[2p1xy+p2^2(r^2+2x^2)]

ydistorted=y+[p1^2(r^2+2y^2)+2p2xy]

for instance if the camera is tilted upwards i might assume p1>0 p2=0

xeffective=x+[2p1xy] (linear correction in x, increasing in half could you please provide a link with more detailed explanation of the plane, decreasing in the other half)

yeffective=y+[p1(r^2+2y^2)] (y always corrected increasing it)

and that would quite work i guess

but i i would really not understand the case camera downwards and p1<0 p2=0 in that case y these formulas (and would be wrongly corrected??!!

am i misunderstanding the formulas??wonderful also with some special case example)?

### Camera calibration With OpenCV - tutorial

i am reading the very interesting tutorial https://docs.opencv.org/3.4.2/d4/d94/tutorial_camera_calibration.html and i find it difficult to understand the formulas equations for tangential distortion

xdistorted=x+[2p1xy+p2(r^2+2x^2)]

ydistorted=y+[p1(r^2+2y^2)+2p2xy]

specifically i don't understand the terms p2(r^2+2x^2) and p1(r^2+2y^2) which seems to me should have always the same sign no matter what sign of p1 or p2, in all 4 areas of the Cartesian plane

could you please provide a link with more detailed explanation explanations of these formulas equations (and would be wonderful also with some special case example)?

also i find some difficulties in the camera matrix equations

i would write

((

in case of central misalignment between optics and sensor we keep the spatial Cartesian reference on the optics and consider the optical center on the sensor (cx,cy) with a misaligned image cartesian refernce

x(camerapixel)-cx(pixel)=fx(pixel)X(mm)/Z(mm) y(camerapixel)-cy(pixel)=fy(pixel)Y(mm)/Z(mm) Z=Z

where fx and fy are proportional to the focal lengths and ideally measure a pixel/mm normalized conversion at Z(mm)=1

))

but i am not sure how to precisely relate this to those equations