Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Can not understand Jacobian Computation Process in function OptimizePairwise #19

Open
YE-ck opened this issue Jan 21, 2019 · 2 comments

Comments

@YE-ck
Copy link

YE-ck commented Jan 21, 2019

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

@qianyizh
Copy link
Collaborator

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.

@zhulz
Copy link

zhulz commented Jan 13, 2022

image

its only the weight ls of data item

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants