MATLAB: How to measure the shortest distance from a point to the edge

binarycolordistanceimage analysisimage segmentation

Hi All,
Can somebody help me how to measure the shortest length ( Perpendicular length) from the dots indicated inside black rectangle to the edge of the black portion on both sides in the following image ?? also, how to measure the shortest length between the points indicated in blue color??

Best Answer

I see the black band, and I see scattered white dots. I do not see any blue points?
The shortest distance from a point (x,y) to the edge of the black is
min([x, width-x, y, height-y])