I want to determine the minimum path between two specific points in the image, i.e. the path for which the sum of the distances between adjacent pixels will be minimized, weighted by the intensity of the pixels (shades of gray). For example, this image shows the input image.

and this is the (drawn) minimum path in red, from UL to the LR angle (black borders serve to fill zero weight):

, Matlab graydist ; - ndimage/scikit-image/ ? scipy.ndimage.morphology.distance_transform_edt, , . , .
, ( , , ), () .