How to convert pixels to cm?
34 views (last 30 days)
Show older comments
How to convert pixels into cm for the area and major axis length?
results =
Area: 16414
MajorAxisLength: 213.8713
0 Comments
Accepted Answer
Image Analyst
on 27 Oct 2013
This is covered by the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_measure_a_distance_or_area_in_real_world_units_instead_of_in_pixels.3F
In addition, I've attached a calibration demo below.
2 Comments
More Answers (2)
Walter Roberson
on 26 Oct 2013
You can't tell if that is the only information you have.
8 Comments
Image Analyst
on 8 Apr 2021
I said that, not Walter, and I gave you an example already, with the moon. Let me paraphrase it and maybe you'll understand it better.
Let's say you had your camera in your front yard on a tripod, and in the field of view you could see a ruler standing on its edge on a table. And let's say just above that you could see the moon in the sky just above the ruler. Now we know the ruler is 12 inches and let's say you measure it some how, like with imdistline() or improfile(), and found out the ruler is 1200 pixels. The spatial calibration factor is therefore (12 inches) / (1200 pixels) = 0.01 inches / pixel. So now we know that for things at that distance of the ruler, they can be measured accurately. If I measure, say, a water bottle that is also standing on the table and find that it is 400 pixels wide, then the real world width of the water bottle would be 400 * 0.01 = 4 inches.
Now let's consider the moon, which is not on the table at a distance of 10 feet, but is actually 239,000 miles away. Let's now measure the moon in the photo, and let's say it's 100 pixels. So now, can we say that the real world diameter of the moon is only 100 * 0.01 = 1 inch? Of course not. We know that the moon is actually 2159 miles in diameter! Why is it not one inch???? The answer is because it is not in the same plane as the ruler where we made our spatial calibration so the magnification is different.
Does that explain it better?
MOUNA RAHAL
on 9 Apr 2021
Sorry i thought that it 's Walter.That is clear for me.thank you. So i need another calibration in that position.
Epah
on 26 Oct 2013
1 Comment
Walter Roberson
on 26 Oct 2013
Lens aperture and distance to the object. Or, something in the image at the same distance as the object and which is of known length. Or something in the image that is of known length, and the distance to both that reference object and the target object are known.
That is, you can use optical properties to determine the true size of the target object, or you can use trigonometry.
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!