Image recognition not always transitive?

I have two images, A and B. if I put A in the trackingImages array on my ARImageTrackingConfiguration and then scan B with my app, it will be recognized. But if I reverse the images, so that B is in the trackingImages array and I scan A, it will not be recognized. This doesn't happen all the time, just with an occasional set of images. Is this expected? If so, why, and if not, how do I stop it from happening? Thanks in advance!

Answered by Vision Pro Engineer in 744583022

That sounds like expected behavior. With a reference image showing only animal A, any images of it will be detected (even if the photo shows animals A+B, A+C, etc.). If your reference image however shows animal A+B, that's what needs to match. So ARKit will detect that exact image, but not an image showing A+C, or only A.

It seems like the images A and B are very similar. In that case, it can happen that one image is mistaken for another one. It's recommended that all images you intend to use with image tracking are distinct from each other to prevent this from happening. Have you tried adding both A and B to the set of trackingImages at the same time? When you drag images into an ARResourceGroup in your project's asset catalog, Xcode should issue a warning if two images look too much alike. In that case, you should try to use a different one if that's possible.

Yes, they are very similar, but that's by design.

What I'm trying to accomplish is to have a series of images which are identical on one side and different on the other side. I want them to match each other. So I took a series of photos. They all have the same stuffed animal on the left side, and different ones on the right side. Except for one image, which has no stuffed animal on the right side. The idea is that the image with one animal should match any of the ones with two. So the one with one animal is tracked, and the others are scanned. This actually works fine.

I was testing and reversed which image was tracked and which was scanned, and that's when I noticed this behavior. It doesn't happen if both images have two stuffed animals.. they match in both directions. It only happens with the image that has only one.

It won't interfere with what I'm trying to do, but the behavior didn't make any sense to me so I wanted to understand what's going on and if it's a sign that I'm doing something wrong.

Accepted Answer

That sounds like expected behavior. With a reference image showing only animal A, any images of it will be detected (even if the photo shows animals A+B, A+C, etc.). If your reference image however shows animal A+B, that's what needs to match. So ARKit will detect that exact image, but not an image showing A+C, or only A.

Image recognition not always transitive?
 
 
Q