Log in or register to post comments

Can I add and activate datasets after some image target is found?

July 9, 2019 - 4:55am #1

Hi all,

I am wondering how can I add and activate datasets from the file after some image target is found? I'd also like to deactivate/unload that database loaded after the target, which previously triggers to add the dataset, is lost.

The reason I want to do this is that I have a fairly large amount of images to be recognized by the AR camera, and I don't want my program to have all the image target added. I'd like to build up a tree. Only when you have detected all the ancestors(image targets), can you detect the leaves(image targets).

I have tried some method, trying to insert the code in the following page:

https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime

to the  OnTrackingFound() function in the Default Trackable Event Handler component of the image target. But it raises an error:

Exception in the callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

Can anyone have some suggestions on how to solve it? Thanks in advance for the help.

As shown in the attachment, I'd like to have DinosaurBack.jpg detected first and then load the some dataset and recognized what is in the blank area like DinosaurTrex.jpg. (the expected outcome is only scan DinosaurTrex.jpg and get the result)

AttachmentSize
Image icon DinosaurBack.jpg210.63 KB
Image icon DinosaurTrex.jpg233.75 KB

Can I add and activate datasets after some image target is found?

July 16, 2019 - 5:08pm #4

Hello,

You can find reference code for loading a dataset using Vuforia APIs in the 8.3 version of the Core Samples: /Assets/SamplesResources/SceneAssets/ModelTargets/Scripts/ModelTargetsManager.cs

You need to disable the tracker when performing this operation, which sounds like it may negatively impact your use case.

Thanks,

Vuforia Engine Support

Can I add and activate datasets after some image target is found?

July 15, 2019 - 5:09pm #3

Hi,

I'd like to ask can I load/modify a dataset while some target is tracked within OnTrackingFound() Function? Or there is something prevent me from changing the dataset while it is being tracked?

Would you also mind telling me where can I find the code concerning dataset activation and deactivation in Vuforia Code Samples assset? I don't find it.

Thanks!

Can I add and activate datasets after some image target is found?

July 15, 2019 - 3:54pm #2

Hello,

I cannot think of any reason why you could not do this. However, I'm wondering if your code is actually working correctly.

I suggest you compare your logic with our Unity Core samples (free on the Asset Store), which demonstrate how to load and activate a device database using Vuforia Engine APIs.

Thanks,

Vuforia Engine Support

Log in or register to post comments