Area, pixel to metre conversion

21 ビュー (過去 30 日間)
Benjamin Dempsey
Benjamin Dempsey 2016 年 3 月 19 日
回答済み: Image Analyst 2016 年 3 月 20 日
I have an image which i have opened in matlab, i found the area of that image in pixels. I know each pixels dimensions by having something else in the background.
would i do the square root of the matlab area value then mutiply it by (my real world factor)^2 ?
Thanks i hope ive explained this well enough

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 3 月 20 日
Suppose you had 7 square inches and wanted that converted to square centimeters. Then since 1 inch is 2.54 cm then 1 square inch is (2.54 cm)^2 = 2.54^2 cm^2 . So 7 square inches would be 7 * 2.54^2 = 45.1612 square centimeters.
Your proposal would have been for sqrt(7) * 2.54^2 = 6.7202 cm^2 . That is obviously wrong as a cm is smaller than an inch so 7 square inches cannot convert to less than 7 square centimeters.
What you can do is (sqrt(7) * 2.54)^2 which includes squaring the entire value not just the conversion factor. That will work fine (at least for positive areas ;-) ) But look again at the expression and expand it and you see that the sqrt(7) is going to get squared and multiplied by 2.54^2, so that is going to be the same as just taking the original 7 and multiplying it by the square of the conversion factor. You therefore might as well not bother taking the square root, and doing will at best be a waste of time and at worst will introduce numeric error for no benefit.

Image Analyst
Image Analyst 2016 年 3 月 20 日
A few years back I developed an application where to spatially calibrate we would put in a 4 inch by 4 inch filter paper into the scene. I found the paper and got its area in pixels. Then I assumed the pixels were square, which they were according to the camera manufacturer. So I found the calibration factor. Let's say that the 4x4 region was 50,000 pixels. Well 4x4" is 10,322.56 mm^2 so the square mm per pixel was 10,322.56/50000 = 0.2064512. That is the factor to multiply area in pixels by to get the area in square mm. To get distances, you'd multiply the length in pixels by sqrt(.2064512) = 0.454369013027957.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by