How to measure distance between two points from two different image?

13 views (last 30 days)
Sorry for asking again. I have very small knowledge about these process but I have to used them.
I have extracted the the images sequence from video.
I have applied ROI and detected the desired objects in an image.
Now I can find the centroid for the desired objected of an image within ROI.
I want to set this image to be a reference image and compare it to others images and measure the distance between their centroid in pixels.
So, how to set first image as reference image, how to fix the ROI assiged to first image to every others image, and how to measure the distance between two centroid between the reference image and other images.
I have read this page since I think it is a very similar situation but some error appeared.
Thank you in advanced.

Answers (1)

Marcel
Marcel on 7 Nov 2022
Well as KSSV pointed out, you can measure the distance between points using code like this
% Location 1 (X, Y)
x1 = 50;
y1 = 50;
% Location 2 (X, Y)
x2 = 100;
y2 = 100;
% Calculate the distance
d=sqrt((y2-y1)^2+(x2-x1)^2);
% Result: 70.7107 Pixel
(code from here)
Im made a software thats takes a picture, finds a specific circle and saves the circle radius and location data. This is my master image, tho im only saving the circle data in my case.
On every new image taken, im comparing the newly found circles with the master circles and calculate stuff like the difference of the current circles form the master circle.
If this is something you are trying to do as well, i can guide you a little bit. Sadly i cant really share the app or code for that as i made it for the company im working for and im sure they wouldnt be happy about that :p
  3 Comments
Chanoknunt Sangsobhon
Chanoknunt Sangsobhon on 10 Nov 2022
Thank you for your guilding and tips! I will study it and adapt them to my case.
Thank you very much!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!