Search Unity

Distortion Coefficients in ARFoundation

Discussion in 'AR' started by georgeb_unity, Apr 20, 2020.

  1. georgeb_unity

    georgeb_unity

    Joined:
    Apr 10, 2019
    Posts:
    3
    I know that with the XRCameraManager, I can get access the the camera intrinsics via
    XRCameraIntrinsics. However, this only gets so far for doing custom effects with the incoming camera texture. Both ARCore and ARKit allow access to the distortion coefficients. Is there any way to get the distortion coefficients of the camera?

    I was reading about the ARCameraBackground and (possibly - there is no documentation on it) there is already lens distortion correction when passing through the default material?
     
  2. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    60
    The camera texture and model you are receiving in AR Foundation is rectilinear. Internally both ARKit and ARCore removes radial lens distortion before providing the background texture and camera projection matrix.

    The two APIs do provide per frame camera intrinsics, but this is only the horizontal and verticals field of view, as well as the camera's center "principal point". They need to recalculate this every frame as the image stabilization and camera focus slightly change these values, but distortion is always compensated for "behind the scenes".
     
  3. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    60
    Older Mobile AR SDKs like Tango and Vuforia did provide radial distortion info, but the newer SDKs realized it was an unnecessary burden for the vast majority of developers.