Start a new topic

How to increase the number of targets in an object collection

Is it possible to increase the number of current targets in an object collection?


After adding 10 object target movies, we received an error "You have reached the maximum of allowed targets in the current target collection".


@Piyush


The easiest way to do this in Unity is to add a second ObjectTrackable child GameObject to the ObjectTracker. For each ObjectTrackable, make sure that the Target Pattern contains the name of the target it is associated with and add the appropriate prefab in the Drawable field. 

So for ObjectTrackable 1 you would have the name of the object 1 target written in the Target Pattern as it was specified in the Target Manager and prefab 1 in the Drawable field. Same for ObjectTrackable 2.


Best regards,

Alexandru


1 person likes this

@Piyush, I havent tried this in Unity so not sure if it will work there. 


What I had to do in the JS-PhoneGap version is to have a 2D multi-object tracker look for fake name tags (which act like QR codes), which then triggers and load the correct 3D Object Trackers. To figure out when a user "wants" to look at a new 3D target, I just use a basic timeout in trackable.onObjectLoss. 


Here is the general steps:

  1. Initialize a 2D collectionResource
  2. Initialize a 3D collectionResource
  3. Create a 2D multi object tracker that scans for multiple images at a time - this scans for a fake name tag of objects (like a QR code, but nicer looking)
  4. When it recognizes a tag, load a corresponding 3D tracker and assets. Also pause the 2D tracker
  5. 3Dtracker onObjectLoss -> after 3000 ms destroy the 3D tracker and resume 2D tracking

This is not very sexy and kinda hacky, but I have gotten it to work for 5 objects spread out around the room. Also needed a poster that explained "Scan the tag to activate AR!"

You can probably change the 2D tracker to be bluetooth based or other physical cues. 


1 person likes this

Hi, I am new to AR and exploring wikitude. I am trying to track multiple objects, but not at once. My use case is that I wish to track different objects kept in different rooms, so no two objects will be in a single frame. I have uploaded the images of the objects in the same project but different object targets and downloaded the wto file. Now to proceed from here, I have a object tracker in my unity project which has trackable as child. I have set the path of wto file in my object tracker. How to I go from here to find which object was recognized? I want to load different prefabs upon different object recognized. So for example, if object 1 is recognized, I want to load prefab 1. Then when I move to second object, it should recognize object 2 and load prefab 2.

Hi Naveem,


As our solution allows to add 10 objects to the object target collection, you can recognize up to 10 objects. Simultanious recognition of more than 1 object is not possible at the moment - so if there are 2 or more objects that you have in your collection in the camera view, only 1 will be recognized and tracked.


We unfortunately don't have a dedicated sample for this, but the priciples are the same as with image recognition and e.g. the sample for different image targets'


Greetings

Nicola

can you please give suggestion how to do multiple object detection within a same scene 

Hi Eva,


No worries. Thanks for double checking.

I think I will pursue using "2D detection that then triggers a specific object tracker" method to get a similar effect. 


Hope multi object tracking comes soon.

Hello Andy,


I deeply apologize for the inconvenience but there has been a misunderstanding from my side. Multiple object recognition is possible but not at once. So there is nothing wrong at your code, this is the Wikitude SDK standard behavior. Again, I am sorry for the misunderstanding.


Thanks

Eva

Hi, 


I've modified the code for multiple image targets, however the multitracking always only detects one object. What else do I need to do to get multiple tracking to work?

Hi Eva,


I've tried using the code below. It seems to only ever detect one of my objects. 

I've downloaded my WTO file from this project in my wikitude studio: 5ad8bb0a4a8cdf1aa9074a4f

this.targetCollectionResource = new AR.TargetCollectionResource("assets/myWTOfile.wto", {});

this.tracker = new AR.ObjectTracker(this.targetCollectionResource, {
    maximumNumberOfConcurrentlyTrackableTargets: 5, // a maximum of 5 targets can be tracked simultaneously
    extendedRangeRecognition: AR.CONST.IMAGE_RECOGNITION_RANGE_EXTENSION.OFF,
    onTargetsLoaded : ()=>{},
    onError         : (errorMessage)=>{ alert(errorMessage)}
});

this.objectTrackable = new AR.ObjectTrackable(this.tracker, "*", {
    drawables: {
        cam: []
    },
    onObjectRecognized: function (targetName) {
         alert(targetName + ' found');
    },
    onObjectLost: function (targetName) { 
        alert(targetName + ' lost') 
    }, 
    onError: function(errorMessage) {
        alert(errorMessage);
    }
});

  Thanks Eva.


 

 

Hi Andy,


You should use the exact same approach that you are using when recognising multiple images. So if you have a look at our example here for multiple image targets, you do exactly the same but you just replace the .wtc file with the .wto file and instead of AR.ImageTrackers you define AR.ObjectTracker.


Thanks

Eva


1 person likes this

Hi Wikitude, 


Can you post an example of tracking multiple objects? 


I have two objects in my WTO file, and instantiated two AR.objectTrackable, one for each. However, the app seems to ever only recognize one object. What should I do?

Hello Federica,

I apologize for the late response. I am afraid though that I do not exactly understand your first question. If you want to have more than one objects in the video you are recording and that you will later use to convert it to your .wto file then, yes this is possible. You can create a .wto file with up to 10 objects there.

Regarding your second question, you can have the model either placed directly as a child GameObject for the Trackable GameObject and position it locally, or assign a prefab with your model in the Drawable field of the Object Trackable component. You can have a position set for that prefab. Please see the Object Tracking scene from our sample project.

 

Thanks

Eva

Thank you Eva!

First question: we can have more trackable under an objectTracker ?


Another question: I've already imported a 3d Object (.fbx) in Unity3D: now i need to place this 3d object in a determinatig position of the scene (I'm using "Tracking Object" as an example): I saw that i can  rotate e scale the object directly from my 3D software, but I can not move it in space, so that it is perfectly positioned above the framed object . Do I have to do it from unity (within the asset, or in the trackable) or from the outside? Do you have an example?


Thank you



Hello Federica,

Object Recognition does not work simultaneously like 'Multiple Image Recognition'. You provide the .wto file that contains these objects and then you start tracking each object. It will work if you track each object separately but not all together.

Thanks
Eva

 

Hi,

i have 3 targets in a single .WTO. How can I use these 3 targets  in the same way as multiple target image recognition (we are using unity3D)? Is it possible?


Thank you!


1 person likes this
Login or Signup to post a comment