How to add multiple image targets for recognition in a Vuforia Unity app

45 Views Asked by At

I want to make the app to recognize multiple image targets and place an augmented 3d object according to it. But now only one image can be selected and it recognizes only one image from database

I was working with this tutorial : https://youtu.be/-bF0oxgtt6A?si=0JVdi0Ii12OpbiuH . I have created a database of imagetargets on vuforia site. The database contains 3 images, However the ImageTarget gameobject selects only one target out of database. How I should be able to track multiple image and set different virtual objects for it. I dont need that all image can be target at one frame. It can be one after one. Do I have to create multiple ImageTarget objects for it or there is another optimal way ?

1

There are 1 best solutions below

0
thesbyro On

Yes, you will need an Image Target Behaviour for each image to track multiple Image Targets. In practice, this means making an Image Target GameObject for each image. The image shows how the Vuforia Core Samples track four Image Targets. I've selected all four GameObjects, and you can see they all use the same Database but have different images set in the Image Target field.

Vuforia Core Sample Image Target scene with the four Image Target GameObjects selected. Each are using different images from the same Device Database

You can also create the Image Targets at runtime. The linked guide has a code snippet that creates an Image Target from all images in a Device Database. The target names can be replaced with your target names, or use a function to retrieve them from the XML dataset file.

And, if you decide to track them simultaneously, the Vuforia Configuration has a setting called Max Simultaneous Tracked Images that you can set higher than the default value of 1.