Intensity-weighted minimal path between 2 points in grayscale image
<p>I want to determine minimum path between two specific points in an image, i.e. the path for which sum of distances between adjacent pixels weighted by pixel intensity (greyscale) will be minimized. For instance, this picture shows the input image</p>

<p><a href="http://i.stack.imgur.com/6hR24.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/6hR24.jpg" alt="original image"></a></p>

<p>and this is the (hand-drawn) minimal path in red, from UL to LR corner (black boundaries serve as zero-weight padding):</p>

<p><a href="http://i.stack.imgur.com/6Y2Wb.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/6Y2Wb.jpg" alt="example minimum path"></a></p>

<p>I found that matlab has the <a href="http://%20https://www.mathworks.com/help/images/ref/graydist.html" rel="nofollow">graydist</a> function just for this; is there something similar in ndimage/scikit-image/whatever? I found <a href="http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.morphology.distance_transform_edt.html#scipy.ndimage.morphology.distance_transform_edt" rel="nofollow">scipy.ndimage.morphology.distance_transform_edt</a> but I am not sure if and how to use it for this purpose. It is OK if the algorithm returns only one of non-unique minima.</p>

<p>I am not interested in implementation hints, it is a fairly straightforward task algorithmically (at least the naive implementation using e.g. dynamic programming), I am looking for (combination of) already coded routines to accomplish this.</p>

<p>This type of dynamic programming is available in scikit-image as <code>route_through_array</code> and <code>shortest_path</code>: <a href="http://scikit-image.org/docs/dev/api/skimage.graph.html" rel="nofollow">http://scikit-image.org/docs/dev/api/skimage.graph.html</a></p>

python numpy scipy scikit-image ndimage