stereolabs / zed-opencv

ZED SDK interface sample for OpenCV
https://www.stereolabs.com/docs/opencv/
MIT License
139 stars 79 forks source link

ACCESSING DEPTH VALUES #89

Closed AlairXu closed 2 years ago

AlairXu commented 2 years ago

Preliminary Checks

Description

In zed-OpenCV, I use the following code to get the depth value. However, what is obtained is the gray value of [0,255]. How can I get the distance in millimeters?

https://www.stereolabs.com/docs/depth-sensing/using-depth/

Steps to Reproduce

` zed.retrieve_image(image_zed, sl.VIEW.LEFT, sl.MEM.CPU, image_size) zed.retrieve_image(depth_image_zed, sl.VIEW.DEPTH, sl.MEM.CPU, image_size)

        x = round(image_size.width / 2)
        y = round(image_size.height / 2)
        err, depth_value = depth_image_zed.get_value(x, y)
        print(depth_value)`

Expected Result

I want to get the distance in millimeters or meters

Actual Result

`[186 186 186 255] [187 187 187 255] [186 186 186 255] [186 186 186 255] [186 186 186 255]

Process finished with exit code -1`

ZED Camera model

ZED2i

Environment

Win10
Intel i7
GTX2060
Zed sdk 3.5.5

Anything else?

No response