zedMat to Unity Render Texture

Hi

I’d like to convert zedMat to Unity Render Texture type
Is there a tutorial for this?

Thank you in advance

Hi,

You can do it like this ;

Texture2D texture = new Texture2D(mat.GetWidth(), mat.GetHeight(), TextureFormat.RGBA32, false);

texture.LoadRawTextureData(mat.GetPtr(), mat.GetHeight() * mat.GetWidth()* mat.GetChannels());

texture.Apply();

Make sure the format of the Texture matches the format of the ZEDMat.

Best,
Benjamin Vallon

Stereolabs Support

1 Like

Thank you so much.
By the way, what I want to do is get the zed camera frame to the texture 2D.
So I created zedMat from the camera.

But are there other options that I can do it?

Thank you always!

The left and right images of the zed are available as a texture here: https://github.com/stereolabs/zed-unity/blob/master/ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/Display/ZEDRenderingPlane.cs#L110 .
This component is present on the “left eye” and “right eye” game objects, in the ZED_Rig_Stereo prefab/.

This texture is getting updated with the new images of the zed automatically.

Stereolabs Support

1 Like