Hi there.
I’m using an image detection library to generate different prefabs on different images. I have 5 images altogether. I want to be able to point the camera at the image and generate a prefab depending on the image (it’s christmas themed, so, an elf on an elf picture, santa on a santa picture etc)
this is the code I was trying. No prefabs yet, just checking that it recognised the images and updated them.
void onTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
{
foreach (ARTrackedImage trackedImage in eventArgs.added)
{
addedCounter += 1;
whichImageAdded = trackedImage.referenceImage.name + "";
}
foreach (ARTrackedImage trackedImage in eventArgs.updated)
{
updatedCounter += 1;
whichImageUpdated = trackedImage.referenceImage.name + "";
}
foreach (ARTrackedImage trackedImage in eventArgs.removed)
{
removedCounter += 1;
}
addedText.text = addedCounter + "";
updatedText.text = updatedCounter + "";
addImage.text = whichImageAdded + "";
updatedImage.text = whichImageUpdated + "";
}
I’ve been getting some strange but consistant results.
When I scan each image in turn, it will always recognise the first image it looks at and update it.
It will add the remaining four images but it will only give update info on two of them.
I’ve tried looking at the images in different orders. The first image is always recognised, so I don’t think the problem is with the images themselves.
Also, by the time the addCounter gets to 5 (the number of images in my Image Recog Library), it will only update the last successfully recognised image and never recognise anything else.
Has anyone come across this behaviour before?