OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 28 Feb 2019 09:56:39 -0600Measuring the speed of an object with variable distance from camerahttp://answers.opencv.org/question/209387/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.Mon, 25 Feb 2019 10:05:38 -0600http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/Comment by Chris for <p>Hi guys, </p>
<p>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.</p>
<p>I briefly understand that from vector calculation its <code>sqrt( (x2 - x1) ** 2 + (y2 - y1) **2 )</code>, but how does the z depth affect this? Would love to have the speed measurement in m/s</p>
<p>Any help would be appreciated. Thank you.</p>
http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209615#post-id-209615Finding 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 coordinatesThu, 28 Feb 2019 09:56:39 -0600http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209615#post-id-209615Comment by tintin95 for <p>Hi guys, </p>
<p>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.</p>
<p>I briefly understand that from vector calculation its <code>sqrt( (x2 - x1) ** 2 + (y2 - y1) **2 )</code>, but how does the z depth affect this? Would love to have the speed measurement in m/s</p>
<p>Any help would be appreciated. Thank you.</p>
http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209403#post-id-209403Yes my bad, I've been using the python mapping for power of 2.Mon, 25 Feb 2019 18:00:22 -0600http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209403#post-id-209403Comment by sjhalayka for <p>Hi guys, </p>
<p>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.</p>
<p>I briefly understand that from vector calculation its <code>sqrt( (x2 - x1) ** 2 + (y2 - y1) **2 )</code>, but how does the z depth affect this? Would love to have the speed measurement in m/s</p>
<p>Any help would be appreciated. Thank you.</p>
http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209393#post-id-209393Also, the distance formula is:
sqrt( (x_2 - x_1)^2 + (y_2 - y_1)^2 ) ... where ^2 means to the power of 2.Mon, 25 Feb 2019 12:32:40 -0600http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209393#post-id-209393Comment by LBerger for <p>Hi guys, </p>
<p>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.</p>
<p>I briefly understand that from vector calculation its <code>sqrt( (x2 - x1) ** 2 + (y2 - y1) **2 )</code>, but how does the z depth affect this? Would love to have the speed measurement in m/s</p>
<p>Any help would be appreciated. Thank you.</p>
http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209389#post-id-209389very weird question.Mon, 25 Feb 2019 11:00:24 -0600http://answers.opencv.org/question/209387/measuring-the-speed-of-an-object-with-variable-distance-from-camera/?comment=209389#post-id-209389