facebookresearch/QuaterNet

Conversion expmap to quaternion wrong?

Closed this issue · 4 comments

Hi, why do you divide by pi in the conversion to quaternion:

xyz = 0.5*np.sinc(0.5*theta/np.pi)*e

Looking at the exponential map paper
https://pdfs.semanticscholar.org/5433/f452dcc9be2b862728e2c3dce9417f0c0b97.pdf
it should just be:
xyz = 0.5*np.sinc(0.5*theta)*e

Hi,

There are two definitions of the sinc function (normalized and unnormalized, see Wikipedia). The paper refers to the unnormalized definition, but NumPy implements the normalized version. Therefore, we simply divide the argument by pi to remove normalization, since theta is already in radians.

Thanks for the reply.
I am still a bit confused, in the paper they use the unnormalized: sinc(x) = sin(x)/x, and numpy uses np.sinc(x)=sin(x*pi)/(x*pi)
So why do you not need to additionally multiply by pi as well e.g.:
xyz = np.pi*0.5*np.sinc(0.5*theta/np.pi)*e

Why? Only the argument needs to be modified, which affects both the numerator and the denominator.

np.sinc(x) = sin(x*pi)/(x*pi)
np.sinc(x/pi) = sin(x*pi/pi)/(x*pi/pi) = sin(x)/x = sinc(x)

Adding a pi coefficient as you did is wrong -- it affects the domain of the function! In your example, when theta = 0 the term becomes pi, while it should be 1 (look at the figure on Wikipedia).

Yeah correct, thanks!