This tool performs a Scharr edge-detection filter on a raster image. The Scharr filter is similar to the sobel_filter and prewitt_filter, in that it identifies areas of high slope in the input image through the calculation of slopes in the x and y directions. A 3 × 3 Scharr filter uses the following schemes to calculate x and y slopes:
X-direction slope
. | . | . |
3 | 0 | -3 |
10 | 0 | -10 |
3 | 0 | -3 |
Y-direction slope
. | . | . |
3 | 10 | 3 |
0 | 0 | 0 |
-3 | -10 | -3 |
Each grid cell in the output image is assigned the square-root of the squared sum of the x and y slopes.
The output image may be overwhelmed by a relatively small number of high-valued pixels, stretching the palette. The user may therefore optionally clip the output image distribution tails by a specified amount (clip) for improved visualization.
def scharr_filter(self, raster: Raster, clip_tails: float = 0.0) -> Raster: ...