Reputation: 11820
Does anyone know what the differences between the Prewitt, Sobel and Laplacian operators in edge detection algorithms?
Are some better than others?
Are different operators used in different situations?
Upvotes: 15
Views: 12369
Reputation: 15867
The laplace operator is a 2nd order derivative operator, the other two are 1st order derivative operators, so they're used in different situations. Sobel/Prewitt measure the slope while the Laplacian measures the change of the slope.
Examples:
If you have a signal with a constant slope (a gradient):
Gradient signal: 1 2 3 4 5 6 7 8 9
a 1st derivative filter (Sobel/Prewitt) will measure the slope, so the filter response is
Sobel result: 2 2 2 2 2 2 2
The result of a lapace filter is 0 for this signal, because the slope is constant.
Example 2: If you have an edge signal:
Edge: 0 0 0 0 1 1 1 1
The sobel filter result has one peak; the sign of the peak depends on the direction of the edge:
Sobel result: 0 0 0 1 1 0 0 0
The laplace filter produces two peaks; the location of the edge corresponds with the zero crossing of the laplace filter result:
Laplace result: 0 0 0 1 -1 0 0 0
So if you want to know the direction of and edge, you'd use a 1st order derivative filter. Also, a Laplace filter is more sensitive to noise than Sobel or Prewitt.
Sobel and Prewitt filters on the other hand are quite similar and are used for the same purposes. Important differences between 1st order derivative filters are
These properties can be measured with artificial test images (like the famous Jähne test patterns, found in "Image Processing" by Bern Jähne). Unfortunately, I didn't find anything about the Prewitt operator in that book, so you'd have to do your own experiments.
In the end, there's always a trade-off between these properties, and which of them is more important depends on the application.
Upvotes: 28