FastGlobalRegistration icon indicating copy to clipboard operation
FastGlobalRegistration copied to clipboard

Can not understand Jacobian Computation Process in function OptimizePairwise

Open YE-ck opened this issue 7 years ago • 2 comments

hello, i read the paper Fast Global Registration, which uses Gauss-Newton method to optimize T by equation 8 at the Section3.2 image I find your calculation of the Jacobian as follows: `

int ii = corres_[c].first; int jj = corres_[c].second; Eigen::Vector3f p, q; p = pointcloud_[i][ii]; q = pcj_copy[jj]; Eigen::Vector3f rpq = p - q;

		int c2 = c;

		float temp = par / (rpq.dot(rpq) + par);
		s[c2] = temp * temp;
                    J.setZero();
		J(1) = -q(2);
		J(2) = q(1);
		J(3) = -1;
		r = rpq(0);
		JTJ += J * J.transpose() * s[c2];
		JTr += J * r * s[c2];
		r2 += r * r * s[c2];

		J.setZero();
		J(2) = -q(0);
		J(0) = q(2);
		J(4) = -1;
		r = rpq(1);
		JTJ += J * J.transpose() * s[c2];
		JTr += J * r * s[c2];
		r2 += r * r * s[c2];

		J.setZero();
		J(0) = -q(1);
		J(1) = q(0);
		J(5) = -1;
		r = rpq(2);
		JTJ += J * J.transpose() * s[c2];
		JTr += J * r * s[c2];
		r2 += r * r * s[c2];

		r2 += (par * (1.0 - sqrt(s[c2])) * (1.0 - sqrt(s[c2])));`

To have a better understanding, I tried to substitute lp,q (equation 6) into objective 3 E(T;L). image image Then I got: image Using chain rule: image So: image And I realize that this equation represents the following line in the code: s[c2] = temp * temp; As far as I am concerned, J(2) should be calculated as follows: image image image image • I see that your calculation of Jacobian is divided into three parts which are quite different from I expected before. Could you explain more about your codes of Jacobian calculation? Thanks, yechuankun

YE-ck avatar Jan 21 '19 03:01 YE-ck

See this page for detailed derivation: http://redwood-data.org/indoor/registration.html

Basically you can only linearize the transformation matrix when alpha, beta, gamma, a, b, c are all very small values. So T cannot be directly linearized in this way. Instead, you need some trick to bring T*^{-1}T to the front and linearize it. And the derivation leads to what's in the code.

qianyizh avatar Jan 31 '19 06:01 qianyizh

image

its only the weight ls of data item

zhulz avatar Jan 13 '22 09:01 zhulz