# Revision history [back]

### 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 it has something to do with the angle of the camera, but I'm not too well-versed in that.

Any help would be appreciated. Thank you.

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

I briefly understand it has something to do with that from vector calculation its sqrt( (x2 - x1) * 2 + (y2 - y1) *2 ), but how does the angle of the camera, but I'm not too well-versed in that. z depth affect this?

Any help would be appreciated. Thank you. you.

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

 4 None berak 32993 ●7 ●81 ●312

### 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 ), **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.