How can I automatically find the maximum distance between two objects?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
khalid jackson
am 18 Jun. 2018
Bearbeitet: Matt J
am 18 Jun. 2018
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 Kommentare
Akzeptierte Antwort
Matt J
am 18 Jun. 2018
Bearbeitet: Matt J
am 18 Jun. 2018
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Segmentation and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!