Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question ARFoundation TryAcquireLatestCpuImage is not synchronized with ARCamera Pose?

Discussion in 'AR' started by scylove1989, Nov 18, 2020.

  1. scylove1989

    scylove1989

    Joined:
    Dec 18, 2015
    Posts:
    5
    I have a question about ARFoundation TryAcquireLatestCpuImage, is it not synchronized with ARCamera Pose?
     
  2. ibrahimpenekli

    ibrahimpenekli

    Joined:
    Mar 10, 2015
    Posts:
    31
    Hi,

    If you use TryAcquireLatestCpuImage in Application.onBeforeRender, you'll get synchronized frame with the camera pose I think.
     
    TreyK-47 likes this.
  3. scylove1989

    scylove1989

    Joined:
    Dec 18, 2015
    Posts:
    5
    Thanks! I test your idea, but it doesn't work. The code like this:

    void Awake()
    {
    Application.onBeforeRender += UpdateCameraImage;
    }


    In UpdateCameraImage , I call TryAcquireLatestCpuImage , and get camera pose in this function or in Update, it still can't work. Did I do something wrong?
     
  4. ibrahimpenekli

    ibrahimpenekli

    Joined:
    Mar 10, 2015
    Posts:
    31
    How did you test that ARFrame pose is not synchronized with camera pose ?
     
  5. scylove1989

    scylove1989

    Joined:
    Dec 18, 2015
    Posts:
    5
    We have a VPS Algo&Application, we use a frame data to localization, and fuse this frame pose with tracker pose and locating pose, we call the result fusion pose. Then we render a arcontent camera by the fusion pose, we find the rendered model is not fixed with the real scene. The arcontent camera and the ARCamera(render the background by ARFoundation) have the same projection matrix, so we think that the frame data acquired by TryAcquireLatestCpuImage is not synchronized with camera pose.
     
  6. ibrahimpenekli

    ibrahimpenekli

    Joined:
    Mar 10, 2015
    Posts:
    31
    We use it for our 3D tracker algorithm and it works well. Did you try to enable "match frame rate" option from AR session?
     
  7. scylove1989

    scylove1989

    Joined:
    Dec 18, 2015
    Posts:
    5
    Yes, it is turned on by default.
    I think that You should call TryAcquireLatestCpuImage to get the frame data and get the frame pose synchronously in your 3D tracker. How did you configure your ARContentCamera, such as the Projection Matrix?
     
  8. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,830
    The method suggested by @ibrahimpenekli is our recommended approach.