1. Sobel Operator
-
Purpose: Approximates the 2D gradient of an image. It computes the gradient separately in the horizontal () and vertical () directions. It incorporates a slight smoothing effect by giving more weight to the center row/column when calculating the derivative in the orthogonal direction.
-
Kernels/Masks (3x3):
- Gradient in the x-direction (): Detects vertical edges.
- Gradient in the y-direction (): Detects horizontal edges. (Note: Sometimes the sign convention is flipped, or the mask is shown as the transpose of with appropriate sign changes. The core idea of differentiation and smoothing remains.)
-
How it works:
- Convolve the input image with the kernel to get the gradient approximation in the x-direction: .
- Convolve the input image with the kernel to get the gradient approximation in the y-direction: .
- Gradient Magnitude: Typically calculated as or approximated as for computational efficiency.
- Gradient Direction: Calculated as . ( handles all quadrants correctly).
-
Properties:
- Uses a neighborhood.
- The weighting factor of 2 for the center row/column provides some averaging/smoothing perpendicular to the derivative direction, making it slightly less sensitive to noise compared to simpler operators like Prewitts or Roberts.
- Widely used due to its balance between performance and computational cost.
2. Prewitts Operator
-
Purpose: Similar to Sobel, it approximates the 2D gradient using first differences, but without the emphasis on center pixels (uniform weighting).
-
Kernels/Masks (3x3):
- Gradient in the x-direction (): Detects vertical edges.
- Gradient in the y-direction (): Detects horizontal edges.
-
How it works: The process is identical to the Sobel operator: convolve with and , then calculate magnitude and direction.
- or
-
Properties:
- Uses a neighborhood.
- Simpler than Sobel as it uses weights of only -1, 0, +1.
- The lack of center weighting makes it slightly more sensitive to noise than Sobel.
- Easy to implement.
3. Roberts (Cross) Operator
-
Purpose: One of the earliest edge detectors, it approximates the gradient using differences between diagonally adjacent pixels.
-
Kernels/Masks (2x2):
- Gradient approximation 1 ( - often associated with one diagonal):
- Gradient approximation 2 ( - often associated with the other diagonal):
-
How it works:
- Convolve the input image with : . Note that the origin of the kernel is usually taken as the top-left pixel.
- Convolve the input image with : .
- Gradient Magnitude: or .
- Gradient Direction: . (Interpretation might relate to diagonal directions).
-
Properties:
- Uses a minimal neighborhood.
- Computationally very fast due to the small kernel size and simple coefficients.
- Highly sensitive to noise because it considers only a very small neighborhood and involves no smoothing.
- Provides a poor approximation of the gradient compared to operators.
- Historically significant but less commonly used in modern applications compared to Sobel or Prewitts, especially when noise is a concern.