The gradient of an image $f$ is defined as:

$\nabla f=\begin{bmatrix} \nabla f_{x} \\ \nabla f_{y} \end{bmatrix} = \begin{bmatrix} \frac{\partial f}{\partial x} \\ \frac{\partial f}{\partial y} \end{bmatrix} , $

Its discrete calculation can be as simple as finite difference. For example

$\nabla f_{x} = \frac{f_n-f_{n-1}}{x_{n}-x_{n-1}} $ and $\nabla f_{y} = \frac{f_n-f_{n-1}}{y_{n}-y_{n-1}}. $

I can simply define the total\whole image gradient is the norm of x and y gradient component:

$||\nabla f|| = \sqrt{(\nabla f_{x})^2+(\nabla f_{y})^2}. $ Nothing fancy so far.

Now I am just wondering, what is the distribution of the image gradient in equation above? Here is an example:

enter image description here

In above image, the histogram of the image gradient really looks exponential to me. This is just an example, but I have seen similar shape of the histogram in many cases.

Can I claim the distribution of an image gradient follows exponential? If not, with what condition I can/cannot make this guess? Thanks a lot.


You can claim it, but it might be better to do a goodness-of-fit test, which tests whether it is ok to assume some data comes from a specific distribution.

One method is the Kolmogorov-Smirnov test, which compares the empirical distribution of your sample to your candidate distribution (in this case, the exponential one), which you get by fitting the distribution to the data (i.e. parameter estimation). Implementation-wise, here it is in R and here it is in Python.

By the way, Ruderman's The Statistics of Natural Images does indeed find something somewhat similar to you, concerning the "un-Gaussian" tail of the gradient magnitudes, across natural images :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.