Reading YUV data with Unity and Tango

I am trying to read YUV data from a Tango camera in order to do some image analysis processing, unfortunately it cannot be done using shaders. I am able to display an image but not read the raw data from the texture. When I try to read, for example, a _Ytex texture containing a packed Y-channel, I only get a series of bytes equal to 205.

I tried to capture a texture from many points:

  • _OnExperimentalUnityFrameAvailable in VideoOverlayListener

  • TangoARScreen Update method

  • OnPostRender Camera object method

  • Several less significant places.

In all cases, I tried to access it both through m_tangoApplication.GetVideoOverlayTextureYUV().m_videoOverlayTextureYand through m_screenMaterial.GetTexture("_YTex"), but always got a series of 205 values.

I suspect that the Tango SDK writes YUV values ​​directly to the GPU's memory, but I am confused about why GetTexture("_YTex")I cannot restore it.

I will probably end up making the specific purpose of rendering for the sole purpose of extracting this data, but of course there might be a more direct way to access the video streams?

Has anyone been able to do this? I am using the latest SDK (Ancha)

+4
source share

Source: https://habr.com/ru/post/1616672/


All Articles