typo/bug in function cvProjectPoints2 ?
A typo/bug in modules\calib3d\calibration.cpp, function cvProjectPoints2 ?
According to the distortion definition we have:
xd = x*cdist*icdist2 + k[2]*a1 + k[3]*a2; (line 1007)
yd = y*cdist*icdist2 + k[2]*a3 + k[3]*a1;
m[i].x = xd*fx + cx;
m[i].y = yd*fy + cy;
where
a1 = 2*x*y;
a2 = r2 + 2*x*x;
a3 = r2 + 2*y*y;
whereas a derivative (line 1080)
double dmxdt = fx*(dxdt[j]*cdist*icdist2 + x*dcdist_dt*icdist2 + x*cdist*dicdist2_dt +
k[2]*da1dt + k[3]*(dr2dt + 2*x*dxdt[j]));
Should the last term be equal 4*x*dxdt[j]
?
Similar places in calculations of dmydt, dmxdr, and dmydr
From the information you wrote, I am inclined to be agree with you.
What you could do is to open an issue here.
Also, what happens if you "correct" the formulas and compare the result ?
The issue has been submitted here and has been fixed also with the corresponding pull requests.