Log in or register to post comments

Additional behavior when Image gets detected

February 26, 2015 - 1:06am #1

Hi everyone ! 

First of all, thanks a lot for this awesome tool !

I would like to know if there is API to be notified when an image gets detected directly in iOS.

I saw that I could do that through an Unity script https://developer.vuforia.com/forum/faq/unity-how-can-i-play-audio-when-targets-get-detected 

but as I want to do complex stuff and use many of my iOS app data I'd like to do this directly in my app code.

I saw that this is possible in Android in the example https://developer.vuforia.com/resources/dev-guide/triggering-ui-events-when-target-detected but this solution strongly relies on graphical stuff and internals.  

In the sticky none I saw this topic but the link is dead : https://developer.vuforia.com/forum/faq/android-how-can-i-update-my-ui-response-tracking-events

 

Thanks a lot for your support !

Additional behavior when Image gets detected

June 23, 2015 - 1:53pm #7

HI There !

I'm looking to implement something like this as well. Could you share your results ?

 

thanks !

-A

Additional behavior when Image gets detected

February 27, 2015 - 9:04am #6

Hi again, 

thanks again for your reply :) Sorry if I wasn't clear, will keep you in tuch if this does the trick !

Additional behavior when Image gets detected

February 27, 2015 - 8:55am #5

Ok, 

now I understand better; you're actually using Unity but want to hook in native iOS code in the project generated by Unity (sorry, I did not get it from your initial post).

Then, you should use the ITrackableEventHandler interface (OnTrackableStateChanged, as you mention) and then call into a native pirce of code from that method.

the VideoPlayback sample shows how you can achieve interaction between Unity and iOS native plugins (see the source code of the VuforiaMedia plugin under Assets/Plugins/iOS after importing the VideoPlayback sample package in Unity).

See also:

http://docs.unity3d.com/Manual/PluginsForIOS.html

 

 

Additional behavior when Image gets detected

February 27, 2015 - 4:49am #4

Hi (again) Alessandro,

thanks a lot for your answer.

What I don't get is that, in the case of Android, we use this code to notify our App through Java reflection. But in the iOS case, I don't see how I can I notify my application.

How can I get the state of each trackable through the ios API ?

When I see what is done in the vuforia samples, that State is obtained through  QCAR::State state = QCAR::Renderer::getInstance().begin();

But in my generated app I don't see what I should include to have access to QCAR::Renderer.

 

Sorry if these are newbie questions, I'm only getting started on Vuforia & Unity.

 

Maybe there is some other piece of code in the Vuforia Samples I should look at ? I can live with

- a piece of ios & android code that returns true if any ImageTarget is being recognized.(I know when to look and which ImageTarget is being recognized through my app logic)

or

- a piece of Unity code that allows to send a message from Unity to my native app or a queue (that I will plug in DefaultTrackableEventHandler.cOnTrackableStateChanged() or ImageTargetBehaviour in Unity)

Additional behavior when Image gets detected

February 27, 2015 - 2:59am #3

The Unity and native API are different. While in Unity, you can use a Trackable Event handler, in native you need to check the trackables reported in the State, as mentioned here:

https://developer.vuforia.com/library//articles/Solution/How-To-Change-the-Android-UI-in-Response-to-Tracking-Events

The relevant code is:

for(int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++)
    {
        // Get the trackable:
        const QCAR::TrackableResult *result = state.getTrackableResult(tIdx);
        QCAR::Trackable &trackable = result->getTrackable();

        // Compare this trackable's id to a globally stored id
        // If this is a new trackable, do something with it
        if (trackable.getId() != lastTrackableId) { ... do something 

 

The code above is using the C++ API of Vuforia, so it is suitable for use in iOS (and does not include any OpenGL or Android specific code, as you can see).

 

 

Additional behavior when Image gets detected

February 27, 2015 - 2:54am #2

I can't find out how to be notified if an image gets detected without relting on a custom view or internal APIs https://developer.vuforia.com/forum/ios/trackableeventhandler-equivalent-ios

Does Vuforia 4 provide an high-level API to be notified when an image gets recognized ?

Log in or register to post comments