Distance between neighbouring objects in an image

4 visualizzazioni (ultimi 30 giorni)
Yash
Yash il 22 Giu 2023
Commentato: Yash il 23 Giu 2023
Hi
I want to calculate the distance between neighbouring objects in a this image. I first convert the image into a binary image. The I locate all the object centroids using regionprops and store them in a matrix. Then, I calculate and plot all the possible distances from the centroid matrix using the distance formula. But this is not what I want. I want an output where distances between only neighbouring images are calculated and plotted.(See image attached).
  5 Commenti
Image Analyst
Image Analyst il 22 Giu 2023
What's the context? Robot path planning? Are you sure you don't want the shortest distance between the perimeters of two objects to each other to see if the vehicle will fit?
Or maybe you want the Hausdorf distance?
We really need to know the context of your problem to know what distance(s) you really need and what constitutes "a neighbor".
Yash
Yash il 23 Giu 2023
Thank you so much @DGM. This was exactly what I was looking for.You have been a huge help. @Image Analyst my colleagues think it is better if shortest distance between the perimeters are calculated. The definition of "neighbour" as defined by @DGM's code works for me. I was wondering if there was a way to just calculate distances from the edges instead of the centroids. Once again, thank you so much for your help.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by