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

3 vues (au cours des 30 derniers jours)
Riccardo Consolo
Riccardo Consolo le 13 Juil 2018
Commenté : Image Analyst le 14 Juin 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.

Réponses (1)

Image Analyst
Image Analyst le 14 Juil 2018
Run my attached spatial calibration demo. It will show you exactly what to do.
  2 commentaires
kamran  zahid
kamran zahid le 14 Juin 2020
Excellen.
Do I need to know the area of my camera covering rectangular frame for this or not?
Image Analyst
Image Analyst le 14 Juin 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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by