ArCore :: anchor - To appear in front of camera always using ArSession_acquireNewAnchor API












0















App-info:



I am developing an Android application based on ArCore (NDK) to augment certain objects (generated from blender tool) over real camera feed. Now that I am able to draw objects as anchors which scales up/down upon camera position changes.



I am using ArSession_acquireNewAnchor API to host an anchor about few inches away from the camera like below.



ArPose_create(ar_session_, nullptr, &camera_pose);
ArPose_getPoseRaw(ar_session_, camera_pose, raw_camera_pose);
ArAnchor *anchor = nullptr;
if (ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)!=AR_SUCCESS) {
LOGE("Anchor is not successfully acquired");
}


After launching the application and holding the device at the same direction, the above anchor is seen.



Problem statement:



When the camera location/direction changes, those anchors are not appearing as expected. Please help - PFB the pictorial representation of the problem.



My Observations:





  1. As I am acquiring the anchor based on camera pose, I assume that direction and pose attributes of anchor will be based on camera pose only i.e. when the camera moves (translation), the anchor too moves accordingly - Is my understanding correct?



    ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)




  2. Upon using hitResult based anchor acquisition, everything works fine i.e. anchor object appears when the devices changes from one direction to other direction at the appropriate location (touch co-ordinates) - However my use-case does not depend on touch input events. I need to achieve the same effect at the pre-defined location co-ordinates of a given scene.



    if(ArHitResult_acquireNewAnchor(ar_session_, ar_hit_result, &anchor)!= AR_SUCCESS) {
    LOGE("NOT SUCCESSFUL");
    return;
    }




Problem-statement



Kindly note that this is being developed using ArCore NDK.










share|improve this question





























    0















    App-info:



    I am developing an Android application based on ArCore (NDK) to augment certain objects (generated from blender tool) over real camera feed. Now that I am able to draw objects as anchors which scales up/down upon camera position changes.



    I am using ArSession_acquireNewAnchor API to host an anchor about few inches away from the camera like below.



    ArPose_create(ar_session_, nullptr, &camera_pose);
    ArPose_getPoseRaw(ar_session_, camera_pose, raw_camera_pose);
    ArAnchor *anchor = nullptr;
    if (ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)!=AR_SUCCESS) {
    LOGE("Anchor is not successfully acquired");
    }


    After launching the application and holding the device at the same direction, the above anchor is seen.



    Problem statement:



    When the camera location/direction changes, those anchors are not appearing as expected. Please help - PFB the pictorial representation of the problem.



    My Observations:





    1. As I am acquiring the anchor based on camera pose, I assume that direction and pose attributes of anchor will be based on camera pose only i.e. when the camera moves (translation), the anchor too moves accordingly - Is my understanding correct?



      ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)




    2. Upon using hitResult based anchor acquisition, everything works fine i.e. anchor object appears when the devices changes from one direction to other direction at the appropriate location (touch co-ordinates) - However my use-case does not depend on touch input events. I need to achieve the same effect at the pre-defined location co-ordinates of a given scene.



      if(ArHitResult_acquireNewAnchor(ar_session_, ar_hit_result, &anchor)!= AR_SUCCESS) {
      LOGE("NOT SUCCESSFUL");
      return;
      }




    Problem-statement



    Kindly note that this is being developed using ArCore NDK.










    share|improve this question



























      0












      0








      0


      2






      App-info:



      I am developing an Android application based on ArCore (NDK) to augment certain objects (generated from blender tool) over real camera feed. Now that I am able to draw objects as anchors which scales up/down upon camera position changes.



      I am using ArSession_acquireNewAnchor API to host an anchor about few inches away from the camera like below.



      ArPose_create(ar_session_, nullptr, &camera_pose);
      ArPose_getPoseRaw(ar_session_, camera_pose, raw_camera_pose);
      ArAnchor *anchor = nullptr;
      if (ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)!=AR_SUCCESS) {
      LOGE("Anchor is not successfully acquired");
      }


      After launching the application and holding the device at the same direction, the above anchor is seen.



      Problem statement:



      When the camera location/direction changes, those anchors are not appearing as expected. Please help - PFB the pictorial representation of the problem.



      My Observations:





      1. As I am acquiring the anchor based on camera pose, I assume that direction and pose attributes of anchor will be based on camera pose only i.e. when the camera moves (translation), the anchor too moves accordingly - Is my understanding correct?



        ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)




      2. Upon using hitResult based anchor acquisition, everything works fine i.e. anchor object appears when the devices changes from one direction to other direction at the appropriate location (touch co-ordinates) - However my use-case does not depend on touch input events. I need to achieve the same effect at the pre-defined location co-ordinates of a given scene.



        if(ArHitResult_acquireNewAnchor(ar_session_, ar_hit_result, &anchor)!= AR_SUCCESS) {
        LOGE("NOT SUCCESSFUL");
        return;
        }




      Problem-statement



      Kindly note that this is being developed using ArCore NDK.










      share|improve this question
















      App-info:



      I am developing an Android application based on ArCore (NDK) to augment certain objects (generated from blender tool) over real camera feed. Now that I am able to draw objects as anchors which scales up/down upon camera position changes.



      I am using ArSession_acquireNewAnchor API to host an anchor about few inches away from the camera like below.



      ArPose_create(ar_session_, nullptr, &camera_pose);
      ArPose_getPoseRaw(ar_session_, camera_pose, raw_camera_pose);
      ArAnchor *anchor = nullptr;
      if (ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)!=AR_SUCCESS) {
      LOGE("Anchor is not successfully acquired");
      }


      After launching the application and holding the device at the same direction, the above anchor is seen.



      Problem statement:



      When the camera location/direction changes, those anchors are not appearing as expected. Please help - PFB the pictorial representation of the problem.



      My Observations:





      1. As I am acquiring the anchor based on camera pose, I assume that direction and pose attributes of anchor will be based on camera pose only i.e. when the camera moves (translation), the anchor too moves accordingly - Is my understanding correct?



        ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)




      2. Upon using hitResult based anchor acquisition, everything works fine i.e. anchor object appears when the devices changes from one direction to other direction at the appropriate location (touch co-ordinates) - However my use-case does not depend on touch input events. I need to achieve the same effect at the pre-defined location co-ordinates of a given scene.



        if(ArHitResult_acquireNewAnchor(ar_session_, ar_hit_result, &anchor)!= AR_SUCCESS) {
        LOGE("NOT SUCCESSFUL");
        return;
        }




      Problem-statement



      Kindly note that this is being developed using ArCore NDK.







      android augmented-reality arcore projection-matrix






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 26 at 5:58







      ShreeVidhya

















      asked Jan 2 at 7:49









      ShreeVidhyaShreeVidhya

      286




      286
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002909%2farcore-anchor-to-appear-in-front-of-camera-always-using-arsession-acquirene%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002909%2farcore-anchor-to-appear-in-front-of-camera-always-using-arsession-acquirene%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith