How to find out the distance between the inner and outer edge of the image using the Matlab command [x,y]=ginput(1)?
1 回表示 (過去 30 日間)
古いコメントを表示
Where ever you click on the following link image, matlab code must find out the two edges and find out the distance between the those two points using [x,y]=ginput(1). http://imageshack.us/photo/my-images/600/imfill.jpg
0 件のコメント
採用された回答
Image Analyst
2013 年 1 月 2 日
I gave you code for calling ginput() in http://www.mathworks.com/matlabcentral/answers/57292#answer_69661 that calculates the distance between two points. Recall where it said:
% Calculate diameters:
outerDiameter = sqrt((xOuter-xCenter)^2+(yOuter-yCenter)^2)
innerDiameter = sqrt((xInner-xCenter)^2+(yInner-yCenter)^2)
Well that's just the Pythagorean theorem. You can replace the two x and y with any any two x and y to get the distance between two points.
2 件のコメント
Image Analyst
2013 年 1 月 3 日
Looking up at the top (your original question here in this post right here), I believe I answered your question of how to find the distance between two points that you specified using ginput(), didn't I?
If you have a follow up to your prior question, where we showed you how to use regionprops(), then post your follow up question in that post, not this one.
その他の回答 (2 件)
Sean de Wolski
2013 年 1 月 2 日
11 件のコメント
Walter Roberson
2013 年 1 月 4 日
info = regionprops(L,'Area','FilledArea');
OD = sqrt(4*(info.FilledArea)/pi)
Walter Roberson
2013 年 1 月 3 日
threshold. Logically negate so the circle becomes the 1's. bwboundaries that. The result for that image would be a 2 x 1 cell array, each entry of which is an array of row and column coordinates that together form one of the boundaries. Find the minimum of the euclidean distances between all points in the first cell and all points in the second cell, and you will have found the minimum distances between the inner and outer boundaries.
You can toss in a ginput(1) if you really want; you would just ignore the value it returns.
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!