Start a new topic

How to reterieve the target name of recognized image from mulitple images

How to reterieve the target name of recognized image from mulitple images


This is my code which is working   :-


trackable2DObject = new AR.Trackable2DObject(logoTracker, "Bunglow", { drawables: { cam: },onEnterFieldOfVision: generate, onExitFieldOfVision:generate });


function generate()?{  ?    document.location = "architectsdk://TrackerDidDiscoveredImageTarget?id="+1; ?}?


But I want this, which is not working
trackable2DObject = new AR.Trackable2DObject(logoTracker, "Bunglow", { drawables: { cam: },onEnterFieldOfVision: generate (Bunglow), onExitFieldOfVision:generate (Bunglow) });
function generate(id)?{  ?    document.location = "architectsdk://TrackerDidDiscoveredImageTarget?id="+id;? }
 
I just want to reterieve the target name of recognized image,i.e which image from multiple images is recognized?
Please suggest me , give some sample code if possible that how to reterieve targetname from Trackable2DObject.

Thanks for reply Sir,

Sir your answer is not visible properly, please repost this answer, last words of you sample code is not seen.

And second thing , i want to reterieve targetids name from database, so how to reterieve this targetids name from databse to this your variable var targetIds
 

var targetIds = ;

on its place i want var targetIds = names from database ? how to do this?

To recognize a target you will need to create a Trackable2dObject for it. At creation the Trackable2dObject requires the targetName.

 

Here is what I would do (be aware untested/never compiled code)

function generate(id) { return function() {

document.location = "architectsdk://TrackerDidDiscoveredImageTarget?id="+id; ?}?

};

var targetIds = ;

for (var i = 0; i < targetIds.length; i++) {

trackable2DObjects.push(new AR.Trackable2DObject(logoTracker, "Bunglow",

{ drawables: { cam: },

onEnterFieldOfVision: generate (targetIds),

onExitFieldOfVision:generate (targetIds)

});

)

}

I updated the initial post to show the previously hidden parts.

Depending on where your database is there are 2 options:


You are using our SDK in your own app and the database is on the device -> execute callJavascript method of the ARchitectView from native code supplying the data you need. e.g. you defined a newData function in your javascript that processes the data, then arView.callJavascript("newData()"); will call the newData mehtod with the array.

You have the data on the server, write a webservice and access it with XMLHttpRequests from javascript.

Thanks Wolfgang

Now i have another problem that my application beomes crashes agter 3-4 successful recognization of images, i think its because of not releasing object array of trackable2d Object's array and Architect object, i am not releasing Architect object because i am using ARC concept ,

 

So tell me how to release trackable2dObjects array which is in my .html file? and is it necessary to release ARchitect object, so my application will not be crashes?

 help me.
 

IR mode, which uses more computing power (and battery power),  is started whenever you create a Tracker. Thus make sure to call destroy() on the Tracker if you don?t require the IR instance anymore. If all Trackers are destroyed, IR mode is exited automatically.

 

So where to apply this destroy methos and how:?

you can call the destroy method on any architect object.

e.g.

var tracker = new AR.Tracker(...);

...

tracker.destroy();

I using this code, , so no image tracking is done ? and its right also because we destroy this object? so where i call this function? please suggest me?    

  var trackObj1=new AR.Trackable2DObject(logoTracker, targetIds, { drawables: { cam: },onEnterFieldOfVision: generate (targetIds), onExitFieldOfVision:generate (targetIds)
                                              });
        
        trackable2DObjects.push(trackObj1);
        
        trackObj1.destroy();

 

I also used this code

var trackObj1=;
        
        trackable2DObjects.push(new AR.Trackable2DObject(logoTracker, targetIds, { drawables: { cam: },onEnterFieldOfVision: generate (targetIds), onExitFieldOfVision:generate (targetIds)
                                              }));
        
        trackable2DObjects.destroy();

 


 
Login or Signup to post a comment