1
$\begingroup$

When taking the gradient of an image one can do $I * \begin{bmatrix}+1 \ 0 \ -1\end{bmatrix}$ (x direction).

As I understand this is basically applying central differences in the x direction, $\delta_h[f](x) = f(x+\tfrac12h)-f(x-\tfrac12h)$. But since the gradient is a vector of the derivatives and $f'(x) \approx \frac{\delta_h[f](x)}{h}$ shouldn't it be $I * \frac{1}{2} \begin{bmatrix}+1 \ 0 \ -1\end{bmatrix}$?

And what about the the Prewitt operator $\begin{bmatrix}+1 \ 0 \ -1 \\+ 1 \ 0 \ -1 \\ +1 \ 0 \ -1\end{bmatrix}$ (x direction)? As I understand there's some relation to finite differences as well, but how does having a 3x3 kernel affect this relation?

$\endgroup$

1 Answer 1

2
$\begingroup$

Yes, the $1/2$ factor correction could be present, so that the magnitudes between a) the continuous derivative and b) the approximated gradient remain consistent in some way: a (continuous) line with a unit slope will have its discretized version get a unit gradient with the $1/2$ factor.

However, as long as the factor is nowhere applied, all gradient magnitudes remain comparable in a relative way. I suspect that, Prewitt being an ancient operator, computations were of concern. As is only involves simple additions and subtractions, one probably did not care about "costly" divisions, and most of all returning non-integer values.

The same happens with other kernels, see using a sobel operator - edge detection. The normalization is somewhat arbitrary, using a sum of absolute values, or in energy, as for Fourier transform normalizations.

However, if one uses different kernels, or different orders of derivations, it is safer to perform a consistent normalization, in order to be able to compare magnitudes.

The idea behind the constant columns is that a vertical edge should spread over several pixels, so you perform an additional averaging in the direction parallel to the edge, to reduce noise effects for instance, providing you with a more robust estimate of the actual gradient.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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