Find car speed from images

I am doing a project to find the speed of a car from images. We take these images from the car. We will mark some object from the 1st image as a link. Using the properties of the same object in the following image, we must calculate the speed of a moving vehicle. Can someone help me? I am using python opencv. I managed to find the marked pixel in the second image using the optical flow method. Can someone help me with the rest?

+8
performance python image-processing opencv opticalflow
source share
1 answer

Knowing the frequency of reception, you should now find the distance between consecutive marker positions.

To find this distance, I suggest you evaluate the marker position for each image. It is clear that the "pose" is a transformation matrix expressing the coordinates of the object relative to the camera. Once you have these consecutive coordinates, you can calculate the distance and then the speed.

Posture assessment is the process of calculating the position and orientation of a known 3D object relative to a 2D camera. The resulting pose is a transformation matrix that describes the reference object in the reference camera.

Pose description

OpenCV implements a posture assessment algorithm: Posit . Doc says:

Given some 3D points (in the object of the coordinate system) of the object, with at least four non-coplanar points, their corresponding 2D projections into images and the focal length of the camera, the algorithm is able to evaluate the pose of the object.

It means:

  • You need to know the focal length of the camera
  • You must know the geometry of your marker.
  • You should be able to match the four iconic points of your marker in a 2D image.

You may need to calculate the focal length of the camera using

Calculating the speed of your car is equivalent to calculating the speed of a marker. (In the first case, the reference is a marker attached to the ground, in the second case, the reference is a camera attached to the vehicle.) This is expressed by the following equation:

speed = D/(t2-t1) 

FROM

D distance [o1 o2] o1 marker position at time t1 o2 marker position at time t2

You can get the elapsed time either by extracting t1 and t2 from the metadata of your photos, or from the frequency of receiving your image display device: t2-t1 = T = 1/F

“Wouldn’t it be better to point out simple things like posters? And if this is not so, can we consider this a 2d object?”

This is not possible with the Posit algorithm (or with any other pose estimation algorithm, as far as I know): this requires four non-coplanar ones . This means that you cannot select a 2D object embedded in three-dimensional space, you need to select an object with some depth.

On the other hand, you can use a very simple form as far as volumes. (E.g. cube)

+10
source share

All Articles