# Images.imedge: grad, phase and orientation

Images.imedge function implementation calculates gradients as `grad_y, grad_x = imgradients(img, kernelfun, border)`

But right in the next line it passes `grad_y, grad_x` into the `magnitude` and `orientation` methods which have parameter list specifed as `grad_x, grad_y`

``````mag = magnitude(grad_y, grad_x)
``````

While it’s not a problem for `magnitude` method which calcs `Base.hypot` but for `orientation` I believe it has direct impact because inside it there is a `atan(grad_x, grad_y)` is calculated

It this a bug or not?

More general question.

In `orientation` method specification it’s said

Calculate the orientation angle of the strongest edge from gradient images

`phase` method

Calculate the rotation angle of the gradient

What does exactly this mean? In geometry terms

As I understand we can calculate angle between ray ( unit vector from coordinate system center to the given point ) and positive ( negative? ) direction of either axis Y or X. Which axis is taken? Which has more absolute value? It’s not clear from code implementation

You can calculate image gradients using EquivariantOperators.Del which is partially built on top of `Images` but has resolution parameters for automatic scaling.