How to find steepest descent path for a peaks graph.

5 views (last 30 days)
I've been given this task, but when I try to find the minimum of these indexes: (i-1, j), (i + 1, j), (i, j-1), (i, j + 1). The min function doesn't work for me.
Find indices (i, j) of the highest point, i.e. the point with the highest z-value. (Hint: Use find). Save x, y and z values of (i, j) of each path-vector, which at this stage only has one item each.
2. Algorithm steepest descent: While point (i, j) does not lie along an edge:
a. neighbor point having the lowest z-value. By neighbors means those points that have index (i-1, j), (i + 1, j), (i, j-1), (i, j + 1).
b. If this neighboring point's z-value is lower than Z (i, j):
I. Do this next point about the current point (i, j).
II. Add the x, y and z values of (i, j) of trail vectors so that they increase their lengths with one item each. Otherwise: Exit algorithm.
c. Return to the top of the algorithm

Answers (1)

Image Analyst
Image Analyst on 27 Sep 2015
imerode is a local min operator. To look at just the 4-connected pixels like you said, you use a cross kernel:
localMins = imerode(grayImage, [0,1,0;1,0,1;0,1,0]);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!