gaoxiang12 / slambook2

edition 2 of the slambook
MIT License
5.46k stars 2.01k forks source link

ch8 optical_flow.cpp bias, jacobian calculate issue #299

Open jhengyilin opened 8 months ago

jhengyilin commented 8 months ago

optical_flow.cpp .......

At line 229 and 238, calculate the Jacobian using central difference for derivative and times -1 for the opposite direction of gradient for iterative minimizing is fine to understand.
However, at line 246, bias is computed with b += -error * J; which is weird since already added the negative sign when defining Jacobian.

If we delete the -1 for Jacobian definition, the bias calculation would be correct.

Is it typo or anything I am missing about the math behind all this Gauss-Newton thing?

Thanks in advance for any help!

jhengyilin commented 8 months ago

New findings......

Is the Jacobain adding a negate sign, i.e. -1.0 because of the reason stating in book ch7.7.3 (page 187) such that the error is defined as "observation - prediction" rather than "prediction - observation".

If the above statement is true, it will self-explained the issue I suppose in the previous comment.

Thanks for any relevant help in advance!