问题描述
我有一个从移动车辆前面录制的视频文件。我将使用OpenCV对象检测和识别,但我坚持一方面。如何确定与已识别对象的距离。
I have a video file recorded from the front of a moving vehicle. I am going to use OpenCV for object detection and recognition but I'm stuck on one aspect. How can I determine the distance from a recognized object.
我可以知道我目前的速度和真实的GPS位置,但这是所有。我不能对我跟踪的对象做任何假设。我计划使用它跟踪和跟踪对象,而不与它们碰撞。理想情况下,我想使用这些数据来导出对象的真实世界位置,如果我可以确定从相机到对象的距离,我可以这样做。
I can know my current speed and real-world GPS position but that is all. I can't make any assumptions about the object I'm tracking. I am planning to use this to track and follow objects without colliding with them. Ideally I would like to use this data to derive the object's real-world position, which I could do if I could determine the distance from the camera to the object.
推荐答案
移动视频时,您可以使用时间视差来确定对象的相对距离。视差:()。
When you have moving video, you can use temporal parallax to determine the relative distance of objects. Parallax: (definition).
效果是同样,我们用我们的眼睛,它可以通过从稍微不同的角度看相同的对象可以获得深度感知。
The effect would be the same we get with our eyes which which can gain depth perception by looking at the same object from slightly different angles. Since you are moving, you can use two successive video frames to get your slightly different angle.
使用视差计算,您可以确定相对大小和对象的距离(相对于彼此)。但是,如果你想要绝对尺寸和距离,你需要一个已知的参考点。
Using parallax calculations, you can determine the relative size and distance of objects (relative to one another). But, if you want the absolute size and distance, you will need a known point of reference.
你还需要知道速度和方向(以及视频帧速率),以便进行计算。您可能能够使用视觉数据推导车辆的速度,但会增加另一个复杂性的维度。
You will also need to know the speed and direction being traveled (as well as the video frame rate) in order to do the calculations. You might be able to derive the speed of the vehicle using the visual data but that adds another dimension of complexity.
技术已经存在。卫星通过比较在短时间内拍摄的多个图像来确定(高度)。我们使用视差通过在地球绕太阳轨道的不同点拍摄夜空来确定星星的距离。我能够通过在短暂的连续拍摄两张照片从飞机窗口创建3-D图像。
The technology already exists. Satellites determine topographic prominence (height) by comparing multiple images taken over a short period of time. We use parallax to determine the distance of stars by taking photos of night sky at different points in earth's orbit around the sun. I was able to create 3-D images out of an airplane window by taking two photographs within short succession.
确切的技术和计算(即使我知道他们在我的头顶)是方式之外的讨论范围。如果我能找到一个体面的参考,我会在这里张贴。
The exact technology and calculations (even if I knew them off the top of my head) are way outside the scope of discussing here. If I can find a decent reference, I will post it here.
这篇关于如何确定与视频中的对象的距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!