# What Does Normalizing Gradient Means?

Since my algorithm needs to detect long, coherent edges, the estimated local magnitude P for each pixel is normalized with respect to the magnitudes in it’s local neighborhood W (i.e., a 5x5 window).

$P_{normalized} = \dfrac{P - \mu _w}{\sigma_w}$

where $\mu _w$ and $\sigma_w$ denote the average and the standard deviation of edge magnitudes in the pixel neighborhood $w$.

This is given in the paper "GradientShop: A Gradient-Domain Optimization Framework for Image and Video Filtering" by Bhat, and I need to implement the algorithm described there. I am not getting, what does normalizing the gradient mean exactly ?

## 2 Answers

Since you're working local it is suggested for you to compare things normalized to their relative surroundings.

The gradient is a vector (2D vector in single channel image).
You can normalize it according to the norm of the gradients surrounding this pixel.

This is what suggested above.

If $\nabla \mathbf{x}=[g_x, g_y]^T$, then the normalized gradient is ${\nabla \mathbf{x}}_n=[\frac{g_x}{\lVert \nabla \mathbf{x} \rVert}, \frac{g_y}{{\lVert \nabla \mathbf{x} \rVert}}]^T$ .