FANDOM


In computer vision, the Sobel operator is a simple edge detection algorithm using the 1st derivative of the intensity information.

The operator uses two 3x3 kernels convolved with the original image to produce a map of intensity gradient. The areas of highest gradient are where the intensity of the image changes rapidly over a few pixels, and are thus likely to represent edges.

Two convolution kernels are needed to detect the first-order derivative of both horizontal and vertical changes in a 2-dimensional image. If we define $ \mathbf{A} $

as the source image, we can compute:

$ \mathbf{G_x} = \begin{bmatrix} -1 & 0 & +1 \\ -2 & 0 & +2 \\ -1 & 0 & +1 \end{bmatrix} * \mathbf{A} \ and\ \mathbf{G_y} = \begin{bmatrix} +1 & +2 & +1 \\ 0 & 0 & 0 \\ -1 & -2 & -1 \end{bmatrix} * \mathbf{A} $


Which can then be combined to give the overall magnitudes using:

$ \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{arctan}\left({ \mathbf{G_y} \over \mathbf{G_x} }\right) $

Where $ \Theta $

will be 0 for a vertical edge, and will increase for edges anti-clockwise of this.

See alsoEdit