Steve on Image Processing

October 23rd, 2007

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.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Steve Eddins manages the Image & Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.

  • murat: Hi Steve, I have an rgb image of a kind of cream and it contains some small black particles (black dots). In...
  • Steve: Ernest—Look at setting the FaceColor property. The code for setting that is shown on the page you asked...
  • Ernest Miller: Hi Steve, Understood. However, can you explain how to change the colors? Thanks, Ernest
  • Jan: Hi Steve Very useful code, yet what if I parts of my rotated+translated object are outside the original...
  • Steve: MoHDa—It might be possible. You’ll need to use one of the options that produces closed edge...
  • MoHDa: I have one question about the ROIPOLY: I have an image with stripes, I use the “edge” command for...
  • Steve: Shahn—My November 17, 2006 post shows you how to do it.
  • Steve: Kay-Uwe—Thanks for following up. I am planning to make it easier to use test directories in a package....
  • shahn: Hello Steve Instead of superimposing a star on the image to show the centroide. How would you superimpose a...
  • Kay-Uwe: Having TestSuite.fromPackag e() would be nice to have, but so far using simple “test” subdirs...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.