I was reading in the wikipedia page of Sobel operator and Prewitt operator that is possible to decompose these two operators (quote form the Formulation paragraph):

"as the products of an averaging and a differentiation kernel, they compute the gradient with smoothing."

I know that this means that I can rewrite and simplify a Prewitt mask (for example) in this way:

\begin{align*} \begin{bmatrix} +1 & 0 & -1 \\ +1 & 0 & -1 \\ +1 & 0 & -1 \end{bmatrix} = \begin{bmatrix} 1\\ 1\\ 1 \end{bmatrix} \begin{bmatrix} +1 & 0 & -1 \end{bmatrix} \end{align*}

But I don't understand what are in these cases the averaging and the differentiation kernel? And, why it is written that they can compute the gradient with smoothing?


The part: \begin{bmatrix} 1\\ 1\\ 1 \end{bmatrix} acts on vertical pixels \begin{bmatrix} x_{1,\cdot}\\ x_{2,\cdot}\\ x_{3,\cdot} \end{bmatrix} as a weighted sum with equal weights, and if divided by $3$ like a 3-point average $(x_{1,\cdot}+x_{2,\cdot}+x_{3,\cdot})/3$.

Then, \begin{bmatrix} +1 & 0 & -1 \end{bmatrix} acts on a row of horizontal pixels \begin{bmatrix} x_{\cdot,1}& x_{\cdot,2}& x_{\cdot,3} \end{bmatrix} like the discrete 3-point derivative: $(x_{\cdot,1}-x_{\cdot,3})/2$ up to the $2$ factor. Here, up to a global $6$ factor, it acts like a smoother vertically combined with a gradient horizontally. The same reasoning works when you switch directions. This notion relates to the separability of a 2D mask into the product of two 1D operators.

Additional sources:


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.