the values for
sl.MEASURE.DEPTH should be consistent for given pixel coordinates. There is an issue in the API and (x,y) are in fact reversed for your depth map. Thank you for reporting it, it will be fixed in the next release ! (https://github.com/stereolabs/zed-examples/issues/380)
I am using the custom detector and calculating it there??
has it been solved please?
what I am doing is that I run the custom detector then calculate the distance after Retrieve display data in the while loop?
x = round(image_left.get_width() / 2)
y = round(image_left.get_height() / 2)
err, point_cloud_value = point_cloud.get_value(x, y)
distance = math.sqrt(point_cloud_value * point_cloud_value +
point_cloud_value * point_cloud_value +
point_cloud_value * point_cloud_value)
what is wrong here??
it gives me a wrong distance 2.68 and the correct distance is 4.8
@joeurban please provide more information about your configuration.
What depth model are you using? What resolution?
Please also note an important fact: DEPTH value and DISTANCE are not the same things.
The depth value is the “Z” coordinate, while distance is the length of the straight line from the left CMOS sensor and the point.
I could find it out, bt I did not go deeper to find the reson
zed.retrieve_measure(point_cloud, sl.MEASURE.XYZRGBA, sl.MEM.CPU, point_cloud_res)
get rid of the point cloud resolution in this line, then you get the correct results