how to measure the shortest distance from a point to the edge ?
4 ビュー (過去 30 日間)
古いコメントを表示
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??
採用された回答
Walter Roberson
2012 年 1 月 6 日
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])
2 件のコメント
その他の回答 (1 件)
Image Analyst
2012 年 1 月 5 日
Use bwdist(). The max of the output image returned by bwdist() is the distance to the closest boundary. Of course this is all a guess since your link doesn't work and I can't see your image. Or use bwboundaries() and run around the boundary coordinates using Pythagorean theorem to find the distance to some know, fixed coordinate.
3 件のコメント
Image Analyst
2012 年 1 月 7 日
I see you finally posted the link below. Since the dots are the ultimate eroded set, which you can get from
ultimateErosion = bwulterode(originalBW);
The distance from any point, including those at the center of your circles, is given by bwdist(). I'm really puzzled as to why you think bwdist doesn't work for irregularly shaped objects. Did you try it? It does work. Just try it.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!