Upslope area – Plateau detection
In my previous upslope area post, I showed this graphic of pixel flow around North Pond in Milford, Massachusetts:
Notice that pixels in the pond have no arrows. In fact, the pixelFlow M-file I showed previously is unable to compute a pixel flow direction or magnitude for these pixels because they are in a flat region, or plateau. More specifically, pixelFlow returns a flow direction of NaN for any pixel that has no downhill neighbor.
There is a simple way to find all such pixels using morphological erosion. Erosion with a flat structuring element is equivalent to a local minimum operator. If the minimum value of a pixel and its neighbors equals the pixel itself, then we'll call it a plateau pixel.
s = load('upslope_sample_dem'); pond = s.Zm(140:280, 160:230); plateaus = imerode(pond, ones(3,3)) == pond; imshow(plateaus, 'InitialMagnification', 'fit') title('Plateaus')
I'd like to classify plateaus into three types:
- plateaus with downhill but no uphill neighbors; these are called regional maxima
- plateaus with uphill but no downhill neighbors; these are called regional minima
- plateaus with both uphill and downhill neighbors
The Image Processing Toolbox has functions that find regional maxima and regional minima:
max_plateaus = imregionalmax(pond); imshow(max_plateaus, 'InitialMagnification', 'fit') title('Max plateaus')
min_plateaus = imregionalmin(pond); imshow(min_plateaus, 'InitialMagnification', 'fit') title('Min plateaus')
We can now identify pixels in plateaus with both uphill and downhill neighbors by using logical operators:
mid_plateaus = plateaus & ~(max_plateaus | min_plateaus); imshow(mid_plateaus, 'InitialMagnification', 'fit') title('Mid plateaus')
Next time I'll work on a procedure for calculating flow directions for these different kinds of plateau pixels.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.