计算图像中的对象大小

时间:2012-04-01 21:08:07

标签: c# math imaging

我有一个对角线视角为73º的相机和一个能够做到1280 * 720的1/4'传感器

我与某个物体有一段固定的距离,我想在相机拍摄的照片上进行测量......

我想过尝试按像素给出一定距离和视角的厘米数量......我不知道这是否是正确的方法....

有人能指出我正确的方式和/或解释如何完成......

非常感谢

2 个答案:

答案 0 :(得分:2)

好的,我想我已经找到了你 -

Tan 45 = 1    
// this is important


sqareroot(1280squared + 720squared) = 1468.6    
// this is the diagonal measured in pixels widths


73/2 = 36.5    
// this is half the diagonal view angle.


1468.6/2 = 734.3

Tan 36.5 = 0.73996

734.3 / 0.73996 = 992.3509  
// this is the amount of pixels you would need 
// to see 45 degrees from the center of the frame.

所以要测量你需要做的对象 -

((pixelDimensionOfObject / 2) / 992.3509) * distance from object = size of object.

请注意,我认为为了使其正确,拍摄和测量的对象必须位于画面的中心。否则我觉得它变得复杂得多。

答案 1 :(得分:0)

我认为这可以反过来想知道对象的距离,我们知道对象的实际大小

相关问题