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

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

3 Comments

Thats very interesting.. Im not sur eof the input X, Y though. My data xi,yi & xm, ym are all individual 1-D arrays
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)

Asked:

on 28 Jan 2016

Commented:

on 28 Jan 2016

Community Treasure Hunt

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

Start Hunting!