MATLAB Answers

how can I find the furthest pair of points in a 3D binary matrix?

9 views (last 30 days)
Naim
Naim on 14 Aug 2017
Commented: Naim on 15 Aug 2017
the 3D matrix only contains one object. I want to know which of the two '1' values are the furthest away from each other. I read through all the functions and there doesn't seem to be a way. Is there one I don't know about?

Accepted Answer

Image Analyst
Image Analyst on 14 Aug 2017
Just do a brute force triple for loop. I attach a way in 2-D. A vectorized way would be to use find() and pdist2(), if you have the Statistics and Machine Learning Toolbox. Attach your 3-D binary image in a .mat file if you need more help. If you do that, let me know if you have the stats toolbox.
  3 Comments
Naim
Naim on 15 Aug 2017
wow, amazing code that did exactly what I wanted it to do. thanks image analyst!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!