Start a new topic
Solved

ImageOnTarget - Multiple Images and AR.ClientTracker

Hello 


I want to have multiple Images which I can scan and receive an AR information.

According to older entries here, it should be possible by now with the SDK 7.

Unfortunately I wasn't able to implement it so far. When I add multiple "AR.ClientTracker's" only the last image works. 


The goal is not like in the documentation or the samples on GitHub to scan one wtc-file and receive multiple AR images. 

The goal is to have different wtc-files and each wtc-file will show an AR image.


Here is my code which works so far (except there is no possibility to remove the trail watermark with our license):

  

var World = {
	loaded: false,

	init: function initFn() {
		this.createOverlays();
	},

	createOverlays: function createOverlaysFn() {
			this.tracker = new AR.ClientTracker("assets/wald.wtc",
	
		{
			onLoaded: this.worldLoaded
		});
 
		var phonegap_text = new AR.ImageResource("assets/HinweisTxt.png");
		var overlayOne = new AR.ImageDrawable(phonegap_text, 0.2, {
			offsetX: -0.015,
			offsetY: -0.25
		});

				var pageOne = new AR.Trackable2DObject(this.tracker, "*", {
			drawables: {
				cam: [samurai_eyes_animate, overlayOne]
			}
		});
	},

	worldLoaded: function worldLoadedFn() {
		var message = " style='text-align: center; font-family:Arial, sans-serif;'";
		document.getElementById('loadingMessage').innerHTML =
			"<div" + message + ">Swipe right or use back button to exit.</div>";

		// Remove Scan target message after 10 sec.
		setTimeout(function() {
			var e = document.getElementById('loadingMessage');
			e.parentElement.removeChild(e);
		}, 10000);
	}
};

World.init();

  

Thanks a lot for any advise...


Hello,

You mentioned that you want to use the Multiple Targets feature but you also mentioned the class AR.ClientTracker. This is a class that we were using in previous SDK's versions and if you are using it then the new features we introduced in SDK 6 are not supported. So I suggest you switch to AR.ImageTracker and have a look at our documentation section here https://www.wikitude.com/external/doc/documentation/latest/android/multipletargets.html#multiple-targets.

Thanks
Eva

 

Hello Eva


Thanks a lot for pointing this out. That was a sample project from PhoneGap which, according your information, is not up to date anymore.

I was able to implement your 01_ImageTracking_2_DifferentTargets project files in my project but I do have two further questions.


I am curious about the picture in the assets folder as well. When I deleted the surfboard and the helmet in the assets folder, it was still working (the pictures still showed up). Am I right building the wtc file also includes the Augment so there is no need to have them in the assets folder as well?


Anyways, when I upload my image in the TargetManager and add an Augment and download the wtc file and just replace your "magazine.wtc" in the multipletargets.js with the generated wtc file the Augment will not show up. Not sure what I am doing wrong but I just changed the wtc file...


Thank you

Hi,

I believe that the images you mentioned that you deleted are not the targets but the images we show in the top bar and we have included in the css section.

Basically, what you need to include in the assets folder is the .wtc file (that has the Image Targets), any augmentation you show and you wish to store locally inside the app (like 3D model) and any other image you may have included in any css code.

When you replace the magazine.wtc file with your own file you either:
1. Need to rename your file to magazine.wtc
2. Change the code in the .js file to point to your file
this.targetCollectionResource = new AR.TargetCollectionResource("assets/ChangeToYourName", {
});


Thanks
Eva

 

Hi Eva


I tried it today a couple more times but it's still not working.

As yesterday the Wikitude example works fine but not with custom augment.


As base I used your ImageTracking_2_DifferentTargets project from GitHub (which works).

- I start the WikitudeStudioManager and upload a custom jpg file (two star rated)

- I add an augmentation which is called imageOne.png (same file, name as in your example and named imageOne.png in the code as well).

- I download the wtc file ("This will generate a WTC-file containing 1 targets for offline recognition"). 

- I rename the wtc file to "magazine.wtc" as in your example and as it is in the code as AR.TargetCollectionResource

- The wtc file and the imageOne.png are both in the assets folder


Basically I just took a custom image as target image and put as augmentation the same file as in your project (imageOne.png) and used the new wtc file. But unfortunately it's not working.


Thanks for your support

zip
(1.33 MB)
Hi,

You are trying to combine two products in a wrong way. If you wish to work with Wikitude Studio and export the project you created there then, I kindly ask you to follow the guide here https://support.wikitude.com/support/discussions/topics/5000082418

Note: The .wtc file does not contain any augmentations, only the image target that needs to be converted to a .wtc file format so that our algorithm will recognize it.

Thanks
Eva

 

Hi Eva


Thanks for your help.

It works so far when I create the Experience JS and use some of my existing code, it works..

I do have a problem with a video in the StudioManager and still the trial watermark but if I can't figure it out I will open up another topic...


Thanks a lot

 

I am trying today to different jpg file and .wtc file create to wikitude after their upload images and .wtc file in android studio and change your image and .wtc file but image is not detecting in android studio.


Thanks

Rushabh

Hi Rushabh,


I apologize but I don't exactly understand what is your issue. Did you try to create a project in Studio and when you try to preview it, it doesn't work?


Thanks,

Eva

Login or Signup to post a comment