Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ML Example Scene: RawVideoCapture

Discussion in 'AR' started by smartglasses, Feb 19, 2020.

  1. smartglasses

    smartglasses

    Joined:
    Feb 19, 2020
    Posts:
    1
    Hey guys,

    I was wondering if somebody would be able to help me out with an issue I've been having. I've been trying to use one of the included Magic Leap example scenes to learn about how to capture and output video in real-time on my headset. The scene called RawVideoCapture seems to do just that; however, the video is in greyscale. I determined that this was because a shader was converting it from redscale to greyscale but I shut this off for now as I want colour video. After some research, I found that within the script RawVideoCaptureVisualizer.cs and in the method OnRawCaptureDataReceived, YUV camera data is being loaded to a texture and output to the display. It seems as though only Y out of the YUV data is being loaded though and the texture format is R8, kind of explaining the redness.

    This brings me to my question. Does anyone know how to convert three separate YUV Buffers into RGB data which I can load as a single texture?

    If you are able to provide any help on this I'd really appreciate it!

    Thanks,
    -Tyler
     

    Attached Files:

    FurySwordXD likes this.
  2. FurySwordXD

    FurySwordXD

    Joined:
    Sep 26, 2019
    Posts:
    1
    upload_2022-10-21_12-27-16.png
    After weeks of trying out different methods, I finally figured it out. This is how you get RGB.

    upload_2022-10-21_12-25-7.png
    Also, the material needs to be of this shader which is provided in one of the magic leap packages
     

    Attached Files:

    Cidergut likes this.