0

I am trying to understand the inner workings of the VLFeat SIFT algorithm and I notice this statement when computing the image gradient:

 *grad++ = vl_mod_2pi_f   (vl_fast_atan2_f (gy, gx) + 2*VL_PI);

I am wondering if this expression is not the same as vl_fast_atan2_f (gy, gx) as we are adding 2 PI and the modulo of the expression on RHS should evaluate to atan2(gy, gx)?

Luca
  • 10,458
  • 24
  • 107
  • 234

1 Answers1

1

vl_fast_atan2_f is an approximated (and thus faster) version of atan2 (see this doc for more details).

Still it returns results in [-pi, pi] so adding 2.pi and take the modulus (vl_mod_2pi_f) rescales the result into [0, 2.pi] which is how the gradient angle is represented.

deltheil
  • 15,496
  • 2
  • 44
  • 64