Why Plus in QuaternionParameterization not half angle axis

101 views
Skip to first unread message

拂石

unread,
Oct 28, 2023, 12:48:25 AM10/28/23
to Ceres Solver
Hi, all.
I have two questions and wish to get your help.
First, question about Plus function in QuaternionParameterization and EigenQuaternionParametetization. 
When the ceres calculate the delta step of so3( delta = theta * Phi, where Phi  the axis and theta the angle), the corresponding delta quaternion should be as [cos(theta / 2), sin(theta  / 2) * Phi], why the Plus function use the format[cos(theta), sin(theta) * Phi] ?
Second, problem of analytical jacobian of  QuaternionParameterizaion quaternion.
I have a residual of N dimension, and i have derivated the analytical jacobian of resiaudl to QuaternionParameterization quaternion, as J with format N * 4.
Should i have to multiply or divide it by 2  to fit the missing 2 in my first qusetion?

Thanks a lot!

Frank Neuhaus

unread,
Oct 28, 2023, 5:23:20 AM10/28/23
to ceres-...@googlegroups.com
Hi,

about your first question: I have asked this in Github already. Basically, the decision on whether or not to add / 2 is arbitrary and does not affect optimization. It does however affect covariance estimation, so keep that in mind. Adding / 2 would probably be more common, but it was found not to be worth changing, as it could potentially break people's existing code. (See here: https://github.com/ceres-solver/ceres-solver/issues/311 )

As for your second question: There is no need to adjust your analytic Jacobian with regards to the QuaternionManifold / Parameterization as Ceres will do that for you.
Basically, say your cost function is:
f(q) -> R^2 where q is a quaternion.
What Ceres does internally is: Compute the Jacobian of f(q [+] delta) as d f(q [+] delta)  / d delta = (d f / d q)   *    (d q [+] (delta+h) / d h) | delta=0
The only thing you provide as a user is d f / d q, which is a 2x4 Jacobian. The term (d q [+] (delta+h) / d h) | delta=0 is computed by the QuaternionParameterization / QuaternionManifold, which will include the correct scale factor.
Providing the Jacobian of f(q [+] delta) directly is not possible in Ceres, unfortunately.

Hope this helps
   Frank

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/5a7ac2aa-7bcb-4c41-a167-bfced1937ed7n%40googlegroups.com.

拂石

unread,
Oct 30, 2023, 11:11:01 AM10/30/23
to Ceres Solver
Hi, Frank. Thanks for your reply. After considering your answer for a long time, i think i finally understand it, and hope you to see if it is correct. In a word, in QuaternionParameterization, ceres use 1/2 AngleAxis to represent so3 lie algebra, so the Plus function does not have the '1/ 2' scale. Then, the final jacobian of residual to rotation calculated by chain role is "residual to 1/2 AngleAxis", so if we wish to use J^TJ to calculate covariance, the result is aboout "half angleAxis".

Frank Neuhaus

unread,
Oct 30, 2023, 11:22:41 AM10/30/23
to ceres-...@googlegroups.com
Hi,

yes, I think you have understood it correctly.

Best,
   Frank


Reply all
Reply to author
Forward
0 new messages