• Community
  • Pixel wise depth data from the depth map

Hi,
I am trying to get the RGB image with a depth map and pixel-wise depth information of the objects in a scene, for which I am trying the "Depth preview" code. I am printing a depth map and a CSV with pixel-wise depth data (Disparity Frame). I have a few questions regarding this. First of all, while testing the code in an indoor setting, it gives a map and some depth data which I suppose is in "centimeter". However, most of the values do not seem sensible based on the distances of the objects from the camera (like showing a distance of 40-60 cm whereas it's more than 1 meter in the scene). Secondly, while trying the code in an outdoor setting, the depth map comes with just one tone blue color image with no disparity, and the CSV contains only the value "0".

I tried to do the same using the "Spatial Detection>Spatial_tiny_yolo" code. However, using that code I was hoping to get an RGB image with a depth map, and depth information in a CSV. When I tried to execute for the indoor setting first it worked ok and I assume the CSV has the data in millimeter units (based on the distance I was holding the camera). Anyway, whenever trying in an outdoor setting same thing as "Depth preview" is happening. The RGB image is just a white color image with no object, the depth map is a blue image and the depth information is containing only 0 values.

I am planning to use OAK D-lite in an outdoor environment. What could be going wrong in this case?

  • erik replied to this.

    Hello afsana , copying from our email conversation:

    I am not entirely sure what's the purpose of CSV files, but from the looks of the outdoor frame you sent it looks like the exposure is way off - as it's mostly just white frame, which also means the disparity matching can't be performed and depth will be mostly invalid (which you have noticed as well, all 0 values). So I think you should try to manually set exposure/ISO so the mono/RGB frames aren't all white - example on how to do that can be found here.

    Thanks, Erik

    Thanks, Erik. I am saving the CSV intending to store/save the depth of the objects from the scene along with the depth map and RGB image.

    I have checked the RGB Camera control settings that you sent, which ran perfectly with the preview and video output of the default code. Then I tried that with altered ISO and exposure time, which also showed the variation of the output very well. Anyway, I noticed the output windows were coming from the Left camera (Based on the position I needed to hold the camera to see the object).

    I tried to execute the Spatial_tiny_yolo code with the control settings command section from RGB camera control. However, these two sample codes are primarily different from each other, except the pipeline and camRGB command. I could not find the parameters I needed to change to control the camera's exposure and iso while saving an still image. Is it the section where the YOLO Specific Parameters are defined?

    If I execute the Spatial_tiny_yolo or the Depth_Preview code in video mode, how is it possible to store the depth information of the objects in a CSV (Be it for the bounding box or pixel-wise)? Or do I need to use some other version of the code for my intent?

    Update: I tried using auto-exposure into the spatial detection tiny yolo one as followed. Again it's not returning a good result for daylight. And even for indoor light, the depth_frame resulted in some values as high as 30000 mm in the saved csv, whereas the distance was only around 3 m. The code mentioned that the distances were in mm.

                            # Connect to device and start pipeline
                            with dai.Device(pipeline) as device:
                                
                                controlQueue = device.getInputQueue('control')
                                
                                print("Autoexposure enable")
                                ctrl = dai.CameraControl()
                                ctrl.setAutoExposureEnable()
                                controlQueue.send(ctrl)

    Any suggestions about the steps?

    Best,
    Afsana



    • erik replied to this.

      Hi afsana , I would suggest manually setting the exposure/sensitivity (both to low values) instead of using auto exposure (which is enabled by default). This example show how you can manually set exposure/sensitivity values using the dai.CameraControl. Could you try that?
      Thanks, Erik

      11 days later