How can I automatically find the maximum distance between two objects?
5 ビュー (過去 30 日間)
古いコメントを表示
I want to find the distance from the dot on the left to the furthest point on the object to the right. How could I do this?
Thank you very much
0 件のコメント
採用された回答
Matt J
2018 年 6 月 18 日
編集済み: Matt J
2018 年 6 月 18 日
justdot= bwareafilt(yourImage,1,'smallest'); %image of dot only
S=regionprops(justdot,'Centroid'); %find center of dot
ctr=flip( round(S.Centroid) );
ic=ctr(1);
jc=ctr(2);
[Iw,Jw]=find( yourImage & ~justdot ); %coordinates of white pixels excluding dot
max_distance=sqrt( max( (ic-Iw).^2+(jc-Jw).^2) ) ); %the result
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!