开发者

Calculate actual velocity using optical flow

开发者 https://www.devze.com 2023-02-08 18:30 出处:网络
How can I find the ac开发者_如何转开发tual real world velocity of an object using the optical flow information obtained from two images? Can anyone help me out?as the commentators have already said we

How can I find the ac开发者_如何转开发tual real world velocity of an object using the optical flow information obtained from two images? Can anyone help me out?


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...


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

0

精彩评论

暂无评论...
验证码 换一张
取 消