# Upslope area – Summary

Back in March I started writing about an algorithm implementation experiment for computing upslope area. Given an "image" whose pixel values are terrain elevations, the upslope area of a pixel is the area of the uphill terrain that drains through that pixel. I chose a paper that looked promising, and I wrote about my progress as I implemented the paper's techniques in MATLAB. Those implementations are available in an "upslope toolbox" on the MATLAB Central File Exchange.

Some of you have probably been scratching your heads, wondering why I've been writing so much about water flow and terrain analysis in an image processing blog. I want to conclude with some thoughts on that very point.

First, this series illustrates quite a few different image processing algorithm implementation techniques. If you implement image processing algorithms in MATLAB, I think it will be well worth your time to take a look. Here are a few of the useful nuggets you'll find:

• Using morphological functions to find pixels with certain relationships to their neighbors. For example, using imerode and relational operators to find all pixels that have no downhill neighbors.
• Using a binary image as a logical mask to index into another image. I use this technique all the time, and you should, too.
• Using linear indexing to process sets of pixels. (Essential!)
• Using linear index offsets to find neighbors of a set of pixels ("neighbor indexing").
• Identifying connected groups of pixels that touch the image border.
• Using a variety of Image Processing Toolbox functions, such as imregionalmin, roifill, bwselect, etc., to achieve different effects.
• Using sparse linear systems to solve for pixel values that are linearly related to neighboring pixel values.
• Visualizing algorithm output:
• By superimposing a quiver plot on an image.
• By superimposing one image transparently on another.

I also believe that terrain analysis techniques like this will continue to find application to other kinds of image processing and image analysis problems, just like the watershed transform did. Much of mathematical morphology applied to image processing is about ordering relationships between pixels and their neighbors, and the upslope area problem fits right into that category. In particular, I would guess that the influence and dependence maps will be useful for a variety of problems.

And hey, it was fun! And if I'm going to keeping writing new content here every week, it's just gotta be fun!

Enjoy.

|

### Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.