我有一个从行驶中的车辆前方录制的视频文件.我将使用 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.
该技术已经存在.卫星通过比较短时间内拍摄的多张图像来确定地形突出度(高度).我们通过在地球围绕太阳运行的轨道上的不同点拍摄夜空照片,使用视差来确定星星的距离.通过在短时间内连续拍摄两张照片,我能够在飞机窗外创建 3D 图像.
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.
这篇关于如何确定与视频中物体的距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!