How can I convert YUV_420_888 to JPG in C#

Note, the Magic Leap 2 can provide both RGB and YUV images from the camera. However, if you need to use YUV format, you will first need to convert the image into RGB before saving it as a JPG. At a high level the steps would be:

  1. Obtain the camera Frame in YUV format
  2. Convert YUV into RGB (simple example : Visualize Camera Output | MagicLeap Developer Documentation)
  3. Use a 3rd party library or unity's built in function to save the texture as a jpeg (Unity - Scripting API: ImageConversion.EncodeToJPG)