Measuring the speed of an object with variable distance from camera
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.
very weird question.
Also, the distance formula is:
sqrt( (x_2 - x_1)^2 + (y_2 - y_1)^2 ) ... where ^2 means to the power of 2.
Yes my bad, I've been using the python mapping for power of 2.
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