How do I measure the conversion between pixels to cm from an image?

13 views (last 30 days)
Riccardo Consolo
Riccardo Consolo on 13 Jul 2018
Commented: Image Analyst on 14 Jun 2020
I have a picture that includes part of a ruler. I want to measure the length of the ruler by tracing a line on the image and see how many pixels correspond to the length of it. How do I trace a line on the picture manually after it is already displayed and save the length in pixels? I can easily do the conversion once I have the length in pixels, but I don't know the function to trace the line.
Thank you.

Answers (1)

Image Analyst
Image Analyst on 14 Jul 2018
Run my attached spatial calibration demo. It will show you exactly what to do.
Image Analyst
Image Analyst on 14 Jun 2020
No, but if you do that makes it easy. Just divide the real world distance of your field of view by the number of pixels across. The demo asks you to draw a line across some known distance, like a ruler or whatever, and then it computes the ratio of real world distance over pixels, which you can then multiply by any pixel-based distance to get the real distance, or multiply its square by areas in pixels to get areas in real world units.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!