# I have a question on SIFT

I am reading a paper on SIFT by Lowe.

In it, gradient magnitudes and orientations are calculated using these formulae:

 I don't know why m(x,y) is calculated above. I heard that gradient magnitude is usually calculated like the following.

$$\sqrt{f_x ^2 + f_y^2}$$

• what is f_x and f_y in your case? they are gradients, right? try to compare it with terms in SIFT. – Abid Rahman K Jul 13 '13 at 6:41

Horizontal and vertical gradients are computed by taking neighbor pixel differences:

$$g_{x}=L(x+1,y)-L(x-1,y)\\g_{y}=L(x,y+1)-L(x,y-1)$$

$$m(x,y)=\sqrt{g_x^2+g_y^{2}}$$
Replacing $g_{x}$ and $g_{y}$ with above will give you the original formula.
Gradients are usually computed by forward or central difference formula, but I think in this case the above is still accurate enough since the image $L$ is smoothed.