• DepthAI-v2
  • How to replace 0 in depth map with farthest from around?

As described here, the invalid depth values are set to 0. I want to replace these values(0) with values which is farthest from around like this. I try to find a similar thing in depthai, but I couldn't yet.
If this question is duplicated really sorry but any advice would helpful.
Thank you.

  • erik replied to this.

    Hi @erik ,
    Thank you for sharing your insight and sorry for my unclear post.
    What I want to achieve is filling all 0 values with farthest value (or nearest value) of neighbors like this way.
    I've tried the example but still there seems to be 0 values in depth map.
    As you pointed out, spatial filter is explained "Spatial Edge-Preserving Filter will fill invalid depth pixels with valid neighboring depth pixels.". But if I understand linked paper correctly, this spatial filter is not trying to fill 0 values. This spatial filter(edge-aware image processing) is trying to achieve smoothing image with edges.
    Do you have any idea to fill all 0 values with farthest value (or nearest value) of neighbors?
    Any advice would be helpful.
    Thank you!

    • erik replied to this.

      Hi izumi ,
      Actually the 0 value is invalid pixel - meaning the spatial filter will try to fill the 0 values. In some cases, where holes are too large, it won't be able to fill everything though. There are also different settings for the filter you could try out. Thoughts?
      Thanks, Erik