• DepthAI
  • How to get XYZ coordinates in mm for specific pixels?

I would like to obtain the XYZ coordinates in millimeters for specific pixels in an image. I have a color image aligned with the depth map, and I read that Spatial Location Calculator can be used when defining regions of interest (ROI). However, I am not interested in calculating the average coordinates of a region—I need the exact coordinates for specific pixels.

Is it possible to achieve this with Spatial Location Calculator, or is there another way to do it? Any guidance would be greatly appreciated!

    jakaskerl

    Thank you so much!

    I have another question. If I have the (x, y) pixel coordinates in the color image (instead of the depth frame), is it enough to use the following settings to properly align the depth map with the RGB image so that I can use the same (x, y) coordinates? Or do I need to do anything else?

    stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)

    stereo.setOutputSize(monoLeft.getResolutionWidth(), monoLeft.getResolutionHeight())

    Thanks in advance!

      lcruz
      Should be good. You should see if the overlap looks good to you. If it does, it's likely totally fine.

      Thanks,
      Jaka