Superposition of spots on an image given by 2 sets of coordainates

1 view (last 30 days)
I have a set of coordinates on an image xi,yi - green circles in image below. I also have a set of coordinates representing the a set of max intensities, xm,ym - red dots below
How can I determine if the max intensity coordinates are within the xi, yi coordinates within a radius of 1 pixel.
Thanks

Accepted Answer

Walter Roberson
Walter Roberson on 28 Jan 2016
  3 Comments
Image Analyst
Image Analyst on 28 Jan 2016
You need to make an xy array of all the red dot location, and of all the green circle locations, and pass those two arrays to pdist2(). Then take the min over columns and see if any are withing the distance you're interested in, like 1.
distances = pdist2(xyRed, xyGreen);
minDistances = min(distances, 2);
itsCloseEnough = minDistances < 1; % or whatever distance you want.

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!