问题描述
想象一下,你在相机距离D处有圣诞树式LED灯。
Imagine you have Christmas-tree style LED light at a distance D from a camera.
了解LED灯的属性(如形状和强度)和相机(如焦距),是否可以使用快照计算从相机到LED灯的距离?
Knowing the properties of both the LED light (such as shape and intensity) and the camera (such as focal length), is it possible to calculate the distance from the camera to the LED light using a snapshot?
如果是,那么准确度如何测量是吗?
If yes, how accurate would the measurement be?
推荐答案
明亮的光源本身并不适合这个,因为明亮的光线通常会扭曲具有 MIE + Rayleight 散射的相邻空间创建雾霾取决于许多事物而不仅仅是照明。此外,相机本身也存在一些问题,例如由扫描线和/或镜头光晕(通常旋转的星形或多边形,有时彩虹色)引起的明亮的H或V线,使得很难测量在某些情况下,图片中的尺寸。
Bright light sources itself are not good for this as the bright light usually distorts the neighboring space with MIE+Rayleight scattering creating haze dependent on many things not just illumination. Also there are few problems in the camera itself like the bright H or V lines caused by charge jump across scan-line and or lens flares (that star like or polygonial shape usually rotated and sometimes rainbow colored) making really hard to measure the size in the image in some cases.
如果你的图像包含这样的问题,我会使用一些已知大小的其他物体,如圣诞球(或灯座/插座,如果可见/可用),那么常绿树的叶子通常都是相同的大小。精度可以这样估算:
In case your image contains such problems I would use some other objects of known size like Christmas balls (or the light holders/sockets if visible/usable) also what about tree leafs for evergreen they usually all the same size. The precision can be estimated like this:
如果 x
方向的相机的 FOV 是 60deg
,分辨率是 640x480
(假设是方形像素)则一个像素是 da = 60deg /640pix=0.09375deg
角度精度。所以对于 h = 5cm = 0.05m
大对象 d = 2.5m
远离相机我看到它是这样的:
If FOV of camera in x
direction is 60deg
and resolution is 640x480
(assuming square pixels) then one pixel is da = 60deg/640pix=0.09375deg
angle accuracy. So for h=5cm=0.05m
big object d=2.5m
distant from camera I see it like this:
tan(ang) = h/d
--------------
ang = atan( h/d) = atan(0.05/2.5) = 1.14 deg
p = ang / da = 1.14/0.09375 = 12.2214 pixel
所以图像可以是12或13像素大计算回来的距离
so image can be either 12 or 13 pixel big so computing the distance back
d = h/tan(p*da)
--------------
d0 = 0.05/tan(12*0.09375) = 2.54615m
d1 = 0.05/tan(13*0.09375) = 2.35024m
acc = 100*max(d-d0,d-d1)/d = 100*max(0.04615,0.25024)/2.5 = ~ 10.0096%
现在您可以看到精度受物体大小和相机距离的影响。此外还有 FOV 和相机本身的分辨率。
Now as you can see the precision is affected by object size and distance from camera. Also on the FOV and resolution of camera itself.
为了改善这一点,您可以使用亚像素精度对象测量......
To improve this you can use sub-pixel precision object measurement ...
这篇关于找到LED的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!