No products are associated with this question.
P = ; s = size(map); [X, Y] = ndgrid(1:s(1), 1:s(2)); mask = abs(X-x) + abs(Y-y) <= 1000; mask(x,y) = false; highestground = max(map(mask)); if highestground <= map(x,y) disp('There is no higher ground to go to within 1000 steps'); return end
Well, the watershed transform won't work because that doesn't guarantee that the path is monotonically increasing. So see Steve's 5 part blog series on path finding: http://blogs.mathworks.com/steve/2011/11/01/exploring-shortest-paths-part-1/
You could also try doing it yourself and find an optimized path with methods like A* http://en.wikipedia.org/wiki/A* and dynamic programming http://en.wikipedia.org/wiki/Dynamic_programming#Checkerboard where you can plug in your own criteria.