![Screen Shot 2019-01-28 at 10.29.34 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/201915/Screen%20Shot%202019-01-28%20at%2010.29.34%20PM.png)
Matlab needs to calculate distance and find pixel size
1 view (last 30 days)
Show older comments
Stelios Fanourakis
on 28 Jan 2019
Answered: Mark Sherstan
on 29 Jan 2019
Hi, I need to do image calibration between two known points on an image.
Let's say that we have those two points [130,799] and [602,799], where the first are rows and then the columns. I know I need to use the euclidean distance equation like this
So assuming
y1 = 130
y2 = 602
x1 = 799
x2 = 799
distanceInPixels = sqrt( (x2-x1).^2 + (y2 - y1).^2);
How do I combine all those stuff and finally get the calibration factor of mm/pixel.
Please help.
0 Comments
Accepted Answer
Mark Sherstan
on 29 Jan 2019
You need to know the distance between those two points. I attachted part of a presentation where I did just that. I placed three "calibration blobs" at the start of the video. Masked the image for green, then red, then blue to find the "blobs". Using the euclidean distance equation you provided I took the known centroid-centroid distance divided by the pixels for each color mask and then averaged the results. Let me know if you have any further questions but you are almost there!
![Screen Shot 2019-01-28 at 10.29.34 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/201915/Screen%20Shot%202019-01-28%20at%2010.29.34%20PM.png)
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!