Search Unity

Get aspect ratio of AR Foundation Feed?

Discussion in 'AR' started by GMM, Aug 10, 2020.

  1. GMM

    GMM

    Joined:
    Sep 24, 2012
    Posts:
    301
    Hello everyone, i am looking to get the accurate aspect ratio of the camera feed, but the returned frame does not return the values i expect.

    My iPhone 11 Pro Max reports that the resolution is 1920x1440, which is fine for the image, but it does not represent how i need the image to look when wanting to save it or present it in a custom way.

    How can i reliably get the intended aspect ratio of how the frame is supposed to be presented?

    The following code only returns the resolution of the AR feed in an unscaled format:
    Code (CSharp):
    1.  
    2. // Get the latest frame and print the size
    3. XRCpuImage frame;
    4. while(!_cameraManager.TryAcquireLatestCpuImage(out frame))
    5.      await Task.Delay(50);
    6.          
    7. Debug.Log(frame.width);
    8. Debug.Log(frame.height);
    9.  

    A visualization of the issue:

    Frame returned straight from AR Foundation:


    Same frame scaled to 16:9:
     
    Last edited: Aug 10, 2020
  2. GMM

    GMM

    Joined:
    Sep 24, 2012
    Posts:
    301
    Still haven't found a solution to this, anyone?