Working with depth maps (RealSense D435)

Someone asked this over email

Hi,

How do I use StereoStream from RealSense? Because it seems it’s not possible to connect it to nodes with CvMat inputs?

The actual use case is that I’d like to use RealSense D435 in range of, say, 0.4-1.0 m and spot three different depths… and currently I need nothing further. So, reading a proper view / image I would be interested only in event on certain depths.

Thanks!

Hi,

To connect RealSense Listener to CvMat nodes you need to use Texture to CvMat node.

Please note that this conversion is a bit costly, so it is recommended to downscale the Texture beforehand. That’s why I’ve inserted a Texture Resize node. The subsequent CvMat Threshold and Find CvMat Circles is just for illustration in this case.

Doing everything with Textures

As to your other question: it might actually be possible to do the whole thing with textures, which is always preferrable.

See the example below:


You can use Texture Slice node to choose the color levels which will get output and which will be turned to black.

Then you could use Get Pixel from Texture to check what’s the color of the sliced texture to see if there was anything at this depth.


Because if it was, then the color components would be larger than 0.

Nodes you also might want to look into are Texture and CvMat Threshold

I hope this helps,
Mitja

1 Like