使用光流计算实际速度
如何使用从两个图像获得的光流信息找到物体的实际速度?有人可以帮我吗?
How can I find the actual real world velocity of an object using the optical flow information obtained from two images? Can anyone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如评论员已经说过的那样,我们需要有关您的问题的更多信息。
基本上:是的,可以从图像计算现实世界的速度
但是所有这一切都取决于以下因素:
为了计算场景中任何跟踪对象的速度,您可能需要所有后面的内容来真正计算场景中的距离。但这要困难得多。
如果您遇到固定车道的情况,即想要测量汽车的速度,我会更喜欢在现实世界中测量或标记点的方法。
因为如果有该信息:
并且一个对象在
t
时间内移动了y px
(您通过计算的刷新率获得该时间),您可以计算它有多少像素将在 1 秒内移动,因为您知道一米有多少个像素,您就会知道它的速度(以米每秒为单位)(或您喜欢的任何其他单位)。您也可以在场景中设置两个标记,然后简单地测量,如何对象从一个标记移动到另一个标记需要多少帧(以及多少时间),这将为您提供更平均的速度,因为如果您以较小的时间步长进行计算,您可能会由于分割问题或简单地得到嘈杂的结果。因为测量的时间跨度越短,变化就相当小,
对于分割,您可以简单地尝试减去两个或三个后续帧,从而导致不。 - 零值,而稳定图像部分的颜色值应减去 0 左右。
也许这可以帮助您解决问题...但当然这取决于您的设置和您想要的目标...您需要提供更多信息然后...
as the commentators have already said we need some more information on your problem.
Basically: Yes, it is possible to calculate real world velocity from an image
But all of this depends on the following things:
For calculating the velocity of any tracked object on the scene you'd probably need all the latter stuff to really calculate the distances in the scene. But this is much more difficult.
If you have the case of a fixed lane where you i.e. want to measure a car's velocity I would prefer the method with measuring or marking points in real world.
Because if have that information:
and an object has moved
y px
int
time (you get that time by the refreshment rate of your calculation) you can calculate how many pixels it will have moved in 1 second and since you know how many pixels are one meter you'd know its speed in meters per second (or any other unit you prefer.You could also just set your two marks in the scene and simply measure, how many frames (and therefore how much time) the object needed to move from one marking to the other. This would give you a more averaged velocity since if you do calculations in small time steps you might get a noisy result due to segmentation problems or simply because changes are fairly small between the shorter the measured timespan is.
Well and for segmentation you could simply try a substraction method. Substract two or three following frames from each other. Moving objects (and therefore image parts that have changed) will result in non-zero values whereas color values of a steady image part should substract to something about 0.
Maybe that helps you with your problem... but of couse this depends on your setting and your desired goal... You'll need to provide more information then...
这个方法很长,但简而言之:
你可以做的是设置一个值来指定物体与相机的距离。
然后捕获第一帧并将其保存在某处。
捕获最后一帧并将其保存在某处。
对两个帧应用阈值。
修剪第一帧左侧的所有像素,然后对第二帧执行相同的操作。
对于详细教程,我认为这篇文章可能会对您有所帮助。
http://morefunscience.blogspot.in/2012/05/calculated -speed-using-webcam.html
This method is quite long but in short:
What you can do is set a value that specifies the distance of object from camera.
Then capture first frame and save it somewhere.
Capture last frame and save it somewhere.
Apply threshold on both the frames.
Trim all the pixels from left of first frame and then do the same for second frame.
For detail tutorial I think this article may help you a bit.
http://morefunscience.blogspot.in/2012/05/calculating-speed-using-webcam.html