Start a new topic

Which method is called when image is recognized in WTArchitect in ios?

Which method is called when image is recognized in WTArchitect in ios?


Which method is called when image is recognized in WTArchitect in ios?

 

Please reply me , actually i want to call a maethod only when image is recognized.? So i want to know which method is call when recognized

Hi,

the iOS SDK doesn't has a designated mehtod which is called if a tracker in your ARchitectWorld found a image target. What you can do to acomplish this is, that you can call 'document.location = architectsdk://TrackerDidDiscoveredImageTarget?id=<aImageTargetID>' in your onEnterFieldOfVisionTrigger of the Trackable2DObject. Then you can set the delegate of your WTArchitectView instance to a object which is conform to the WTArchitectViewDelegate protocol and which implements the -urlWasInvoked: method. Inside urlWasInvoked, you can check if the passed url is equal to the url which you passed as your document.location. If you have multiple image targets, you can check the id which you can pass as an paramter of the url. After that, you can call any method in ObjC that you want to.

Best regards

Andreas

Thanks Sir,

I have another problem that as in IR ImageRecognization, when image is recognized so an overlay of architect image is show and four arrows is shown, So can i call a javascript method on click of that overlay image when image is recognized.

Is this is possible then please tell me how to set architect overlay's click event and its calling a javascript method on its click..

Hi,

the overlay is an AR.ImageDrawable. According to the specification, you can add a onClick trigger function which is called each time you tap on the overlay.

As you can see in the SimpleIRWorld, there is the variable overaly:

var overlay = new AR.ImageDrawable(image, 1.0, {zOrder: 0});

You can define a onClick trigger like that:

overlay.onClick = function(){

    alert('click on drawable');

    // you can call any other JS function here

};

Best regards

Andreas

Thanks a lot Sir Andreas ,

My problem is solved , because you help me.

I used onEnterFieldOfVision this for calling method after image is recognized.

Thanks.
 

Hello Sir,

My last one problem ,  How to set a unique id of recognized image , i have set two images in traceble and its properly recognized, but i want to set unique id to each image, please say me how can i do this because on basis of this id i want to open different pages in objective c?

My code is :-

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

Tell me what to edit in this to set id or how to set id=<aImageTargetID> in document.location = "architectsdk://TrackerDidDiscoveredImageTarget?id=<aImageTargetID>;... , so how to know aImageTargetID ?

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

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.
 

 

Hello Sir,

Your 1st reply help me alot, now can you please suggest me how to pass this argument in onEnterFieldOfVisionTrigger of the Trackable2DObject.

you say me this priviously but how t oset this

'document.location = architectsdk://TrackerDidDiscoveredImageTarget?id=<aImageTargetID>' in your onEnterFieldOfVisionTrigger of the Trackable2DObject.

 

i tried this but its not working:-

   trackable2DObject = new AR.Trackable2DObject(logoTracker, "Hut", { drawables: { cam: },onEnterFieldOfVision: "architectsdk://TrackerDidDiscoveredImageTarget?id=Hut", onExitFieldOfVision:"architectsdk://TrackerDidDiscoveredImageTarget?id=Hut"});

Tell me where i am wrong?


 

Hi,

try this (untested)

   trackable2DObject = new AR.Trackable2DObject(logoTracker, "Hut", { drawables: { cam: },

onEnterFieldOfVision: function(){

      "architectsdk://TrackerDidDiscoveredImageTarget?id=Hut";

},

onExitFieldOfVision: function(){

   "architectsdk://TrackerDidDiscoveredImageTarget?id=Hut";

}

});

 

andreas

Thanks Andreas  Sir,

Yes its works, i tested this.

Sir, Now i want to make an array of trackable2DObject and keep images reference in that array in it, so how to create trackable2DObject's Array and i want to reterieve images name and project name from webserver, because i want to track multiple images which is in my webserver.

1) I want to send multiple images in  traceproject which would be ready for tracing from qualcom,Flow which i want is --> my all webserver images is 1st go to qualCom at a time and then ready to trace, then I download that traceble project.So, How to send all images at a time to qualcom and my all images become ready for tracing? please suggest me this first Sir?

2) Then if this  happens successfully,i want to keep this traceble project in my database, and then reterieve images and project name from databse and send it to trackable2DObject's Array which is in my HTML file, this is the flow i want , How to achieve this Suggest me Sir.

is it possible to pass name of images and projectname in which this images lies to our .html file, how can i acheieve this please guide me or if you have any demo code so please provide
 

Hi,

1)

I'm not aware if this is possible, please check with qualcomm if you can create a dataset which contains multiple image targets with a qualcomm api.

 

2)

Since an architectworld is just like a regular html page, use javascript to access your webservice that will give you the names and image target urls that you need for creating the trackable2dobjects in javascript.

 

3)

Have a look at xmlhttprequest to connect to a webservice. Additionally libraries like jquery simplifies this.  

 

Best regards

Andreas

 

Thanks Andreas sir

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:?
 

Hi,

please have a look at this link: http://devzone.wikitude.com/web/forum/home/-/message_boards/message/146313?p_p_auth=p4YuVvMH.

You can call destroy whenever you're done using a specific tracker.

Best regards

Andreas
Login or Signup to post a comment