I want to know theorem behind sobel operator. basically a first order derivative is -1/2 0 1/2 . its a vector. the question is how this vector is turned to a matrix below and what was theory and reason behind that? -1 0 1; -2 0 2; -1 0 1;



The Sobel edge detector was introduced back in 1968 by Irwin Sobel and Gary Feldman as the Sobel-Feldman operator. In broad strokes, 'edges' in images are related to gradients, which motivated their development of a discrete differentiation operator. The Sobel-Feldman operator only computes an approximation of the gradient and not the actual gradient. However, this integer valued operator is simple and fast, which makes it useful.


The Sobel-Feldman operator is only capable of estimating gradients along mutually perpendicular directions separately and not jointly. Since an image is typically a matrix itself, the operator provides gradients along rows and gradients along columns. This limitation is important since we will use this property to extend the operator to multiple dimensions.

Matrix Decomposition

The Sobel-Feldman operator in 2 dimensions is given as a kernel matrix. For image matrix $\mathcal{I}$, the Gradient operator (Sobel edge detector) for x- and y- directions is given as:

$\mathbf {G} _{x}={\begin{bmatrix}+1&0&-1\\+2&0&-2\\+1&0&-1\end{bmatrix}}*\mathbf {\mathcal{I}} \quad {\mbox{and}}\quad \mathbf {G} _{y}={\begin{bmatrix}+1&+2&+1\\0&0&0\\-1&-2&-1\end{bmatrix}}*\mathbf {\mathcal{I}} $

Sobel kernels can be decomposed as the products of an averaging and a differentiation kernel. For example,

$\mathbf {G} _{x}= {\begin{bmatrix}+1&0&-1\\+2&0&-2\\+1&0&-1\end{bmatrix}}={\begin{bmatrix}1\\2\\1\end{bmatrix}}{\begin{bmatrix}+1&0&-1\end{bmatrix}}$

This is the key idea in extending the Sobel operator from 1-D vector to 2-D matrix. The operator uses a triangle-kernel for averaging (smoothing) in the direction perpendicular to the desired gradient direction and the Sobel differentiator in the desired direction.

Higher Dimensions

Sobel–Feldman filters for image derivatives in different dimensions with $x,y,z,t\in \left\{0,-1,1\right\}$:

vector: $h_{x}'(x)=h'(x); h_{x}'(x)=h'(x)$

matrix: $h_{x}'(x,y)=h'(x)h(y) h_{x}'(x,y)=h'(x)h(y)$

Tensor: $h_{x}'(x,y,z)=h'(x)h(y)h(z) h_{x}'(x,y,z)=h'(x)h(y)h(z)$

Tensor: $h_{x}'(x,y,z,t)=h'(x)h(y)h(z)h(t) h_{x}'(x,y,z,t)=h'(x)h(y)h(z)h(t)$

Tensor Sobel operator

For 3-D (x,y,z), the Sobel-Feldman operator in z-direction is:

$h_{z}'(:,:,-1)={\begin{bmatrix}+1&+2&+1\\+2&+4&+2\\+1&+2&+1\end{bmatrix}}\quad h_{z}'(:,:,0)={\begin{bmatrix}0&0&0\\0&0&0\\0&0&0\end{bmatrix}}\quad h_{z}'(:,:,1)={\begin{bmatrix}-1&-2&-1\\-2&-4&-2\\-1&-2&-1\end{bmatrix}}$


  1. The Sobel operator is only a poor approximation of gradient using a center-difference operator.

  2. The operator is only informative about 1 direction at a time.

  3. The operator is extended to higher dimensions by using a triangle shaped averaging filter for other perpendicular directions (dimensions).

  4. There isn't a deep theoretical reasoning behind this operator. It is a discretized version of a differential (gradient) and Gaussian filter (smoothing). But it is simple and fast.


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.