Measuring the speed of an object with variable distance from camera

asked 2019-02-25 10:05:38 -0500

tintin95 gravatar image

updated 2019-02-25 13:31:43 -0500

berak gravatar image

Hi guys,

In the past few months, I've gotten to understand the how opencv works and how best we to detect and track a moving object with background subtraction. From the BGS I managed to get the distance of the object I am tracking as I'm using a D435 stereoscopic camera. So with the x, y in px and z in meters, how should I go about in calculating the distance of the object I'm tracking.

I briefly understand that from vector calculation its sqrt( (x2 - x1) ** 2 + (y2 - y1) **2 ), but how does the z depth affect this? Would love to have the speed measurement in m/s

Any help would be appreciated. Thank you.

edit retag flag offensive close merge delete

Comments

very weird question.

LBerger gravatar imageLBerger ( 2019-02-25 11:00:24 -0500 )edit

Also, the distance formula is:

sqrt( (x_2 - x_1)^2 + (y_2 - y_1)^2 ) ... where ^2 means to the power of 2.

sjhalayka gravatar imagesjhalayka ( 2019-02-25 12:32:40 -0500 )edit

Yes my bad, I've been using the python mapping for power of 2.

tintin95 gravatar imagetintin95 ( 2019-02-25 18:00:22 -0500 )edit

Finding the world or 3d distance between 2 points is a common issue when working with depth sensing cameras

Many depth cameras have the capability of generating 3d positions for point cloud output.

Is this the Intel RealSense depth camera?

If so, you can likely get 3d positions from Intel's RealSense SDK

If you can look up or compute the 3d positions for 2 different pixels, then the 3d distance is

sqrt( (xw2 - xw1)^ 2 + (yw2 - yw1)^2 + (zw2 - zw1)^2 ), where xw, yw, zw are world coordinates

Chris gravatar imageChris ( 2019-02-28 09:56:39 -0500 )edit