Edge & Feature Detection
Edge & Feature Detection finds the places where an image changes abruptly: field boundaries, roads, shorelines, roof outlines, geological lineaments. These are the building blocks of any attempt to extract shapes rather than classify surfaces.
All these tools work on a single band, so run them on one channel, on a brightness image, or on an index rather than on a colour composite.
Start here
Section titled “Start here”Canny Edge Detection
Section titled “Canny Edge Detection”The reference method, and the one to use when you want clean, thin, connected edges rather than a gradient map.
It runs five stages: a Gaussian blur to remove noise, a Sobel gradient, thinning of the gradient ridges to one pixel, a double threshold, and a hysteresis step that keeps weak edges only when they connect to strong ones. That last stage is what produces continuous contours instead of a dotted line.
Two thresholds to set. The high one decides what certainly is an edge, the low one what may be an edge if it connects to a certain one. A common starting point is a high threshold that keeps only the obvious boundaries and a low one at about a third of it.
Sobel Filter
Section titled “Sobel Filter”The workhorse gradient operator. It measures the rate of change in the horizontal and vertical directions and combines them into an edge magnitude.
The output is a continuous gradient image, not a binary edge map: bright where the image changes fast, dark where it is uniform. Useful on its own as a texture like layer, and as the input to a threshold.
Prewitt, Roberts Cross and Scharr are variations on the same idea. Prewitt weights its kernel differently, Roberts uses a minimal two by two kernel and is very fast but noise sensitive, Scharr is more accurate for diagonal edges.
Laplacian Filter and Laplacian Of Gaussians Filter
Section titled “Laplacian Filter and Laplacian Of Gaussians Filter”Where gradient operators measure the slope of the intensity, the Laplacian measures its curvature, which responds to edges in every direction at once rather than in a chosen one.
The plain Laplacian is very sensitive to noise, which is why Laplacian Of Gaussians exists: it blurs first, then applies the Laplacian. Its blur radius selects the size of the features you detect, so it is also a way of finding blobs of a given scale.
Corner Detection
Section titled “Corner Detection”Finds corner patterns in a binary raster, using hit and miss templates. Useful after a segmentation or a thresholding, to identify the vertices of built structures.
All the tools
Section titled “All the tools”| Tool | What it does |
|---|---|
| Canny Edge Detection | Multi stage detection producing thin, connected edges. |
| Sobel Filter | Gradient magnitude from horizontal and vertical derivative kernels. |
| Prewitt Filter | Gradient operator with different kernel weights from Sobel. |
| Roberts Cross Filter | Minimal two by two diagonal gradient operator. Fast, noise sensitive. |
| Scharr Filter | Gradient operator with better rotational accuracy than Sobel. |
| Laplacian Filter | Second derivative, responding to edges in all directions. |
| Laplacian Of Gaussians Filter | Gaussian smoothing followed by a Laplacian, selecting a feature scale. |
| Corner Detection | Finds corner patterns in a binary raster. |
Smooth first. Every one of these operators amplifies noise. On a noisy image, run a median or a bilateral filter from Filters before detecting edges.
Edges are not vectors. The output is a raster marking where the changes are. To turn thin binary edges into something usable, Line Thinning and Remove Spurs, also in Filters, clean the skeleton up.
Linear features have their own tools. For roads, hedgerows and vessels, Line Detection Filter and Frangi Filter in Filters are designed for elongated structures and often work better than a general edge detector.