• DepthAI-v2
  • StereoDepth.depth vs. YoloSpatialDetectionNetwork

Hi!

StereoDepth.depth says it is returning distance in millimeters for a pixel, why do I want to use YoloSpatialDetectionNetwork.spatialCoordinates.z instead?

Thanks!

    Hi Kristoffer
    StereoDepth will give you a depth map for every pixel in the frame.

    YoloSpatialDetectionNetwork will give you the bounding box for a detected object. Along the bbox, you will also get the spatials (x, y, z), which will update if that object moves.

    So if you wish to track some stationary object, use the depth map. If the object moves, use Spatial Yolo.

    Thanks,
    Jaka

    6 days later

    Hi!

    Can you give an example of a stationary object where a depth map would be more appropriate?

    Thanks!

      Hi Kristoffer
      Say you want to (for whatever reason) measure the water level with depth perception. Essentially you are looking at the distance from a fixed camera to a buoyant body floating in the water. Since the body is locked in x and y and only changes in Z axis, you can measure the depth at predetermined set of pixels. Since the same pixels are occupied by the body, there is no need to add tracking to the pipeline. (the view of the body gets smaller as the distance increases, but let's assume this difference is minimal in our case).

      I hope that makes sense.

      Thanks,
      Jaka