Does anyone know how to get the depth data of particular pixel (x,y) ?

    Hi jenanaputra
    To get the depth data of a particular pixel (x,y), you can use the depth map that DepthAI provides. The depth map is a 2D array where each pixel represents the depth value at that particular location. You can access the depth value of a particular pixel by indexing into this array with the x and y coordinates.

    Here is a simple example in Python:

    "Assuming frame is your depth map"
    depth_value = frame[y, x]

    Please note that the value of depth data is stored in uint16, where 0 means that the distance is invalid/unknown. The actual depth can be calculated by multiplying the depth value with the depth unit, which can be retrieved using StereoDepthConfig.getDepthUnit().

    Thanks,
    Jaka

      thanks jakaskerl . one more question. I tried to run the program spatial-tiny-yolo.py from the depthai-python repo, I get the x,y,z value of detected object. In that code, it is stated that those values is relative to the center of depth map. what does it mean? is it as same as the camera frame ?

        Hi jenanaputra
        If depth is aligned to that camera, yes. If you wish to make it for color camera, add stereo.setDepthAlign(dai.CameraBoardSocket.RGB). Then I believe the centers should be aligned.

        Thanks,
        Jaka