How to find out the distance between the inner and outer edge of the image using the Matlab command [x,y]=ginput(1)?
古いコメントを表示
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
採用された回答
その他の回答 (2 件)
Sean de Wolski
2013 年 1 月 2 日
0 投票
11 件のコメント
Image Analyst
2013 年 1 月 2 日
Yes, so would I. improfile() is also somewhat similar. Amongst numerous posts on this he seems to be bouncing back and forth between using automatic (i.e. regionprops) methods to find circle diameters and using manual methods by having the user manually specify points. I'm still puzzled why he can't just pick a method and go with it, and why there are lots of posts on this same ring/target/circle diameter issue.
Sean de Wolski
2013 年 1 月 2 日
編集済み: Sean de Wolski
2013 年 1 月 2 日
improfile()!; I learn something new every day
Naresh Naik
2013 年 1 月 3 日
Walter Roberson
2013 年 1 月 3 日
If you threshold that image, leaving white as logical true (or 1), then regionprops() is going to return statistics for two objects, one for the solid white inner core of the circle, and the other for the remaining white background. The centroid property of the object with the eccentricity closest to 0 will be the centroid of the solid white inner core of the circle, no matter where it is in the image.
And if you invert the image either at the time of thresholding or immediately afterwards, so that the dark area becomes logical 1, then regionprops would, for the single-circle image, find only one object, and the centroid of that one object would be the centroid of the black ring. The regionprops MajorAxisLength would then be the outer diameter of the black ring. The calculation from more regionprops properties,
sqrt( 4 * (FilledArea - Area)/pi )
will then be the inner diameter of the black ring.
Naresh Naik
2013 年 1 月 4 日
編集済み: Naresh Naik
2013 年 1 月 4 日
Teja Muppirala
2013 年 1 月 4 日
The outer diameter is given by
sqrt( 4 * (FilledArea)/pi )
which is
sqrt( 4 * (48540)/pi )
ans =
248.6022
This is in agreement with what you found manually.
Walter Roberson
2013 年 1 月 4 日
Odd. Why would MajorAxisLength be substantially different than the outer diameter in the case of a circle? Unless there are some stray pixels being picked up??
Naresh Naik
2013 年 1 月 4 日
編集済み: Naresh Naik
2013 年 1 月 4 日
Walter Roberson
2013 年 1 月 4 日
When you showed "Area: 19363" and so on, how did you generate that information? Show the code from the regionprops() call on to the place you display that information.
Naresh Naik
2013 年 1 月 4 日
編集済み: Walter Roberson
2013 年 1 月 4 日
Walter Roberson
2013 年 1 月 4 日
info = regionprops(L,'Area','FilledArea');
OD = sqrt(4*(info.FilledArea)/pi)
Walter Roberson
2013 年 1 月 3 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Axis Labels についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!