使用光流计算实际速度

发布于 2024-10-16 14:02:53 字数 41 浏览 3 评论 0原文

如何使用从两个图像获得的光流信息找到物体的实际速度?有人可以帮我吗?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫瑟鸿黎 2024-10-23 14:02:54

正如评论员已经说过的那样,我们需要有关您的问题的更多信息。
基本上:是的,可以从图像计算现实世界的速度

但是所有这一切都取决于以下因素:

  • 您的相机是固定的还是甚至可能在移动
  • 您是否尝试计算任何物体的速度物体在场景中的任何地方移动,或者您是否有固定的车道,例如用安装的摄像机拍摄的街道,并且物体(汽车)将始终沿着一条车道移动?
  • 如果是后者,你能在现实世界中的街道上进行测量吗?就像在木板路上标记点一样(永久或简单地找出现实世界中 x 米的距离将以像素为单位出现在相机图像上的距离),
  • 如果您无法在现实世界场景中进行这些测量,您将需要提供信息相机与场景/地面的角度、相机与场景的距离以及相机的参数。

为了计算场景中任何跟踪对象的速度,您可能需要所有后面的内容来真正计算场景中的距离。但这要困难得多。

如果您遇到固定车道的情况,即想要测量汽车的速度,我会更喜欢在现实世界中测量或标记点的方法。

因为如果有该信息:

x m = y px

并且一个对象在 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:

  • Is your camera fixed or is it maybe even moving
  • Do you try to calculate velocity of any object moving anywhere on the scene or do you have a fixed lane, like a street filmed with a mounted camera and objects (cars) will always move along one lane?
  • If the latter, can you do measurements on the street in real world? Like marking points on the boardwalk (permanently or simply to find out to how long a distance of x meters in real world will appear on your camera image in pixels)
  • if you cannot do those measurements in the real world scene you will need to provide information on angle of the camera to the scene/ground level, distance of the camera to the scene, and parameters of your camera.

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:

x m = y px

and an object has moved y px in t 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...

痴骨ら 2024-10-23 14:02:54

这个方法很长,但简而言之:

你可以做的是设置一个值来指定物体与相机的距离。

然后捕获第一帧并将其保存在某处。

捕获最后一帧并将其保存在某处。

对两个帧应用阈值。

修剪第一帧左侧的所有像素,然后对第二帧执行相同的操作。

对于详细教程,我认为这篇文章可能会对您有所帮助。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文