The Prewitt operator is one of the first algorithms for edge detection by gradient transform. It is developed by Judith M. S. Prewitt and is a popular tool for image analysis.
Gradient Detection Demo
On our online test page you can see and compare the most popular gradient detectors for free without any installation, registration or whatever.
How does the Prewitt operator works?
The Prewitt operator works by a convolution with two filter masks that define the first derivative of the signal (image).
Like other gradient detection operators, this one has separable property as well. For example we can represent Gx as:
We apply both masks to each pixel of the image. In this way we find the difference in the intensity levels of the neighboring pixels in both directions.
To calculate gradient orientation we can use the following equation:
The image below is an example result of Prewitt edge detector. The picture is filtered with Gaussian blur to reduce image noise.
Other gradient operators
Gradient detection is a common task in image analysis and there are alternative operators for this purpose. Some of which are:
- Sobel-Feldman operator
- Scharr operator
What is the difference between Prewitt and Sobel?
In fact, the gradient differentiation operators like Prewitt, Sobel and Scharr share the same principle of work. All of them use a separable kernels to calculate the gradient approximation.
The main difference is that the Prewitt filter uses the same weight for all the pixels that fall under the masks. Unlike Prewitt, Sobel and Scharr give less weight to points far from the center pixel.