Start a new topic

Image recognition

Image recognition


I'm referring to these code sections:

var imgTwo = new AR.ImageResource("assets/adamsOne.jpg");
var overlayTwo = new AR.ImageDrawable(imgTwo, 0.5, {
offsetX: 0.12,
offsetY: -0.01
});


 

These are the augmenations - in the sample application the surfoard png and the helmet. In my test I left these and only used your images (your tracker.wtc) with the assets from the sample app and it worked as expected. You can check the sample here

Greetings

Nicola

 

i copied them from my desktop in the assets file of the project and in android studio i can see them in the project manager.

when i replace the Trackable2DObject from rolexOne to * it shows both of the icons that is normal! but when i change it again to rolexOne it shows nothing.

it is very weird because my code is that what i send you!

I just tried your .wtc file and it works fine - as you referenced rolexOne.jpg and adamsOne.jpg as augmentations in your assetfolder - did you make sure that these images are existing and should be used as augementations?

Greetings

Nicola

i only gave the project a name and then uploaded the images and wikitude created for me the wtc.

Hi,

Can you also please provide the .wtc file.

Thx and greetings

Nicola

where am i wrong my image have the names rolexOne,rolex,adams,adamsOne ! they are jpg files


var World = {
loaded: false,

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

createOverlays: function createOverlaysFn() {
/*
First an AR.ClientTracker needs to be created in order to start the recognition engine. It is initialized with a URL specific to the target collection. Optional parameters are passed as object in the last argument. In this case a callback function for the onLoaded trigger is set. Once the tracker is fully loaded the function worldLoaded() is called.

Important: If you replace the tracker file with your own, make sure to change the target name accordingly.
Use a specific target name to respond only to a certain target or use a wildcard to respond to any or a certain group of targets.

Adding multiple targets to a target collection is straightforward. Simply follow our Target Management Tool documentation. Each target in the target collection is identified by its target name. By using this target name, it is possible to create an AR.Trackable2DObject for every target in the target collection.
*/
this.tracker = new AR.ClientTracker("assets/tracker.wtc", {
onLoaded: this.worldLoaded
});

/*
The next step is to create the augmentation. In this example an image resource is created and passed to the AR.ImageDrawable. A drawable is a visual component that can be connected to an IR target (AR.Trackable2DObject) or a geolocated object (AR.GeoObject). The AR.ImageDrawable is initialized by the image and its size. Optional parameters allow for position it relative to the recognized target.
*/

// Create overlay for page one
var imgOne = new AR.ImageResource("assets/rolexOne.jpg");
var overlayOne = new AR.ImageDrawable(imgOne, 1, {
offsetX: -0.15,
offsetY: 0
});

/*
This combines everything by creating an AR.Trackable2DObject with the previously created tracker, the name of the image target as defined in the target collection and the drawable that should augment the recognized image.
Note that this time a specific target name is used to create a specific augmentation for that exact target.
*/
var pageOne= new AR.Trackable2DObject(this.tracker, "rolexOne", {
drawables: {
cam: overlayOne
}
});

/*
Similar to the first part, the image resource and the AR.ImageDrawable for the second overlay are created.
*/
var imgTwo = new AR.ImageResource("assets/adamsOne.jpg");
var overlayTwo = new AR.ImageDrawable(imgTwo, 0.5, {
offsetX: 0.12,
offsetY: -0.01
});

/*
The AR.Trackable2DObject for the second page uses the same tracker but with a different target name and the second overlay.
*/
var pageTwo = new AR.Trackable2DObject(this.tracker, "adamsOne", {
drawables: {
cam: overlayTwo
}
});
},

worldLoaded: function worldLoadedFn() {
var cssDivInstructions = " style='display: table-cell;vertical-align: middle; text-align: right; width: 50%; padding-right: 15px;'";
var cssDivSurfer = " style='display: table-cell;vertical-align: middle; text-align: left; padding-right: 15px; width: 38px'";
var cssDivBiker = " style='display: table-cell;vertical-align: middle; text-align: left; padding-right: 15px;'";
document.getElementById('loadingMessage').innerHTML =
"<div" + cssDivInstructions + ">Scan Target &#35;1 (rolex) or &#35;2 (adams):</div>" +
"<div" + cssDivSurfer + "><img src='assets/rolex.jpg'></img></div>" +
"<div" + cssDivBiker + "><img src='assets/adams.JPG'></img></div>";

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

World.init();


 

Hi,

Did you follow those steps:

Recognize your own images


Upload your images to the target management tool (log-in required)

Generate your target collection file (.wtc)

In your code create an AR.ClientTracker and load the target collection file from the previous step

Create an AR.Trackable2DObject and assign your targetName



Make sure that the targetName used with the AR.Trackable2DObject correspond to one of the target names in your target collection. You can also use a wildcard to match any target or only a specific subset of targets. Please refer to the AR.Trackable2DObject main documentation for more information about wildcards.

Greetings

Nicola


 

Hello,

i want the sample app to recognize my image i downloaded a lincens key and i made a wtc from wikitude,

but it dont recognize my image, i tried the surfer and the bike and it wokrs fine. I change the names in the javascript file i move my icons in the assets file

but nothing happens it shows me for 10 second witch image i should show and it is my image.

In the single Image recognition it runs fine with my images in the multiplet targets it dont work

what am i doing wrong all for android studio
Login or Signup to post a comment