e01.org

Sobel operator

The Sobel operator, sometimes called the Sobel–Feldman operator or Sobel filter, is used in image processing and computer vision, particularly within edge detection algorithms where it creates an image emphasizing edges. It is named after Irwin Sobel and Gary M. Feldman, colleagues at the Stanford Artificial Intelligence Laboratory (SAIL). Sobel and Feldman presented the idea of an "Isotropic 3 × 3 Image Gradient Operator" at a talk at SAIL in 1968. Technically, it is a discrete differentiation operator, computing an approximation of the gradient of the image intensity function. At each point in the image, the result of the Sobel–Feldman operator is either the corresponding gradient vector... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

The Sobel operator, sometimes called the Sobel–Feldman operator or Sobel filter, is used in image processing and computer vision, particularly within edge detection algorithms where it creates an image emphasizing edges. It is named after Irwin Sobel and Gary M. Feldman, colleagues at the Stanford Artificial Intelligence Laboratory (SAIL). Sobel and Feldman presented the idea of an "Isotropic 3 × 3 Image Gradient Operator" at a talk at SAIL in 1968. Technically, it is a discrete differentiation operator, computing an approximation of the gradient of the image intensity function. At each point in the image, the result of the Sobel–Feldman operator is either the corresponding gradient vector or the norm of this vector. The Sobel–Feldman operator is based on convolving the image with a small, separable, and integer-valued filter in the horizontal and vertical directions and is therefore relatively inexpensive in terms of computations. On the other hand, the gradient approximation that it produces is relatively crude, in particular for high-frequency variations in the image. ==Formulation== The operator uses two 3×3 kernels which are convolved with the original image to calculate approximations of the derivatives – one for horizontal changes, and one for vertical. If we define A as the source image, and G x and G y are two images which at each point contain the horizontal and vertical derivative approximations respectively, the computations are as follows: \begin{aligned} \mathbf{G}_x &= \begin{bmatrix} -1 & 0 & +1 \\ -2 & 0 & +2 \\ -1 & 0 & +1 \end{bmatrix} * \mathbf{A} \\ \mathbf{G}_y &= \begin{bmatrix} -1 & -2 & -1\\ 0 & 0 & 0 \\ +1 & +2 & +1 \end{bmatrix} * \mathbf{A} \end{aligned} where * here denotes the 2-dimensional signal processing convolution operation. In his text describing the origin of the operator, Sobel shows different signs for these kernels. He defined the operators as neighborhood masks (i.e. correlation kernels), and therefore are mirrored from what described here as convolution kernels. He also assumed the vertical axis increasing upwards instead of downwards as is common in image processing nowadays, and hence the vertical kernel is flipped. Since the Sobel kernels can be decomposed as the products of an averaging and a differentiation kernel, they compute the gradient with smoothing. For example, \mathbf{G}_x and \mathbf{G}_y can be written as \begin{aligned} \mathbf{G}_x &= \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix} * \left ( \begin{bmatrix} 1 & 0 & -1 \end{bmatrix} * \mathbf{A} \right ) \\ \mathbf{G}_y &= \begin{bmatrix} +1 \\ 0 \\ -1 \end{bmatrix} * \left ( \begin{bmatrix} 1 & 2 & 1 \end{bmatrix} * \mathbf{A} \right ) \end{aligned} The x-coordinate is defined here as increasing in the "right"-direction, and the y-coordinate is defined as increasing in the "down"-direction. At each point in the image, the resulting gradient approximations can be combined to give the gradient magnitude, using Pythagorean addition: \mathbf{G} = \sqrt{ {\mathbf{G}_x}^2 + {\mathbf{G}_y}^2 } Using this information, we can also calculate the gradient's direction: \mathbf{\Theta} = \operatorname{atan2}( \mathbf{G}_y , \mathbf{G}_x ) where, for example, \mathbf{\Theta} is 0 for a vertical edge which is lighter on the right side (for \operatorname{atan2} see atan2). Smoothing perpendicular to the derivative direction with a triangle filter: h(-1) = 1, h(0) = 2, h(1) = 1 Simple central difference in the derivative direction: h'(-1) = 1, h'(0) = 0, h'(1) = -1 Sobel–Feldman filters for image derivatives in different dimensions with x,y,z,t \in \left\{0, -1, 1\right\} : 1D: h_x'(x) = h'(x); 2D: h_x'(x,y) = h'(x)h(y) 2D: h_y'(x,y) = h(x)h'(y) 3D: h_y'(x,y,z) = h(x)h'(y)h(z) 3D: h_z'(x,y,z) = h(x)h(y)h'(z) 4D: h_x'(x,y,z,t) = h'(x)h(y)h(z)h(t) Thus as an example the 3D Sobel–Feldman kernel in z-direction: 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} \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & -1 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} * \begin{bmatrix} 1 \\ 1 \end{bmatrix} \begin{bmatrix} 1 & -1 \end{bmatrix} * \begin{bmatrix} 1 & 1 \end{bmatrix} \begin{bmatrix} \ \ 1 & \ \ 2 & \ \ 1 \\ \ \ 0 & \ \ 0 & \ \ 0 \\ -1 & -2 & -1 \end{bmatrix} = \begin{bmatrix} \ \ 1 \\ \ \ 0 \\ -1 \end{bmatrix} \begin{bmatrix} 1 & 2 & 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} * \begin{bmatrix} \ \ 1 \\ -1 \end{bmatrix} \begin{bmatrix} 1 & 1 \end{bmatrix} * \begin{bmatrix} 1 & 1 \end{bmatrix} and the two derivatives G x and G y can therefore be computed as \mathbf{G}_x = \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix} * \left ( \begin{bmatrix} 1 & 0 & -1 \end{bmatrix} * \mathbf{A} \right ) \quad \mbox{and} \quad \mathbf{G}_y = \begin{bmatrix} \ \ 1 \\ \ \ 0 \\ -1 \end{bmatrix} * \left ( \begin{bmatrix} 1 & 2 & 1 \end{bmatrix} * \mathbf{A} \right ) In certain implementations, this separable computation may be advantageous since it implies fewer arithmetic computations for each image point. Applying convolution K to pixel group P can be represented in pseudocode as: N(x,y) = \sum_{i=-1}^{1} \sum_{j=-1}^1 K(i,j)\, P(x-i,y-j) where N(x,y) represents the new pixel matrix resulted after applying the convolution K to P; P being the original pixel matrix. h_x'(:,:) = \begin{bmatrix} +3 & 0 & -3 \\ +10 & 0 & -10 \\ +3 & 0 & -3 \end{bmatrix} \ \ \ \ \ \ \ \ \ h_y'(:,:) = \begin{bmatrix} +3 & +10 & +3 \\ 0 & 0 & 0 \\ -3 & -10 & -3 \end{bmatrix} This factors similarly: \begin{bmatrix} 3 & 10 & 3 \end{bmatrix} = \begin{bmatrix} 3 & 1 \end{bmatrix} * \begin{bmatrix} 1 & 3 \end{bmatrix} Scharr operators result from an optimization minimizing weighted mean squared angular error in the Fourier domain. This optimization is done under the condition that resulting filters are numerically consistent. Therefore they really are derivative kernels rather than merely keeping symmetry constraints. The optimal 8 bit integer valued 3x3 filter stemming from Scharr's theory is h_x'(:,:) = \begin{bmatrix} 47 & 0 & -47 \\ 162 & 0 & -162 \\ 47 & 0 & -47 \end{bmatrix} \ \ \ \ \ \ \ \ \ h_y'(:,:) = \begin{bmatrix} 47 & 162 & 47 \\ 0 & 0 & 0 \\ -47 & -162 & -47 \end{bmatrix} A similar optimization strategy and resulting filters were also presented by Farid and Simoncelli. They also investigate higher-order derivative schemes. In contrast to the work of Scharr, these filters are not enforced to be numerically consistent. The problem of derivative filter design has been revisited e.g. by Kroon. Derivative filters based on arbitrary cubic splines were presented by Hast. He showed how first and second order derivatives can be computed correctly using cubic or trigonometric splines by a double filtering approach giving filters of length 7. Another similar operator that was originally generated from the Sobel operator is the Kayyali operator, a perfect rotational symmetry based convolution filter 3x3. Orientation-optimal derivative kernels drastically reduce systematic estimation errors in optical flow estimation. Larger schemes with even higher accuracy and optimized filter families for extended optical flow estimation have been presented in subsequent work by Scharr. Second order derivative filter sets have been investigated for transparent motion estimation. It has been observed that the larger the resulting kernels are, the better they approximate derivative-of-Gaussian filters. ==See also== Digital image processing Feature detection (computer vision) Feature extraction Discrete Laplace operator Prewitt operator ==References== ==External links== Sobel edge detection in OpenCV Sobel Filter, in the SciPy Python Library Bibliographic citations for Irwin Sobel in DBLP Sobel edge detection example using computer algorithms Sobel edge detection for image processing

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Sobel operator". 1776955247. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1350726076

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·