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

Question Trouble manipulating NV12 SoftwareBitmap using Unity Texture2D

Discussion in 'AR' started by mattycorbett, Nov 2, 2022.

  1. mattycorbett

    mattycorbett

    Joined:
    May 9, 2021
    Posts:
    13
    I am using UWP's MediaCapture API to capture frames from the HoloLens 2 and use them as input to the UWP FaceDetector class. The only input format that MediaCapture can produce that is compatible is NV12. This part works just fine. After this, I am using the detected faces and their 3D positions to alter the frame itself for logging. I am attempting to use Texture2D.SetPixels. When I take the original NV12 frame, and try to add it to a Texture 2D with TextureFormat.BGRA32 (or any other RGB variation) the image doesnt convert during the LoadRawTextureData call. Is there a way to convert his in Unity with a minimal performace hit? Example of the output of the Texture2D transition below.
     

    Attached Files:

    • 35.jpg
      35.jpg
      File size:
      115.1 KB
      Views:
      100