MATLAB Answers

calculating the distances of the centers of objects to each other at image

2 views (last 30 days)
Özge Akbülbül
Özge Akbülbül on 14 May 2018
Commented: Rik on 8 Jun 2021
Hi everyone I am working on image processing project.There is an image who has circular roi (region of interest) and there is a two object at the circular roi.I want to calculate distances of the centers of objects each other and i wanna find the center points of circular area.How can i do this?Can someone give me tips about it?Thank you already.
  1 Comment
Rik
Rik on 8 Jun 2021
Backup of this question (with image retrieved from imgur):
calculating the distances of the centers of objects to each other at image
Hi everyone I am working on image processing project.There is an image who has circular roi (region of interest) and there is a two object at the circular roi.I want to calculate distances of the centers of objects each other and i wanna find the center points of circular area.How can i do this?Can someone give me tips about it?Thank you already.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 14 May 2018
If you have the Statistics and Machine Learning Toolbox, use pdist2
props = regionprops(binaryImage, 'Centroid');
centroids = [props.Centroid];
xCentroids = centroids(1:2:end);
yCentroids = centroids(2:2:end);
xy = [xCentroids, yCentroids];
distances = pdist2(xy, xy)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by