ARKit – Image recognition with similar images but different colors

Viewed 341

I have a 2D marker that has a color scheme of red. I used ARKit's ARReferenceImage to detect images via rear camera. I'm having problems with the marker because it detects similar images but in different color scheme, I think ARKit recognizes only the pattern and disregarding the color.

I already implemented the basic code for image recognition from here

What my goal is to avoid detecting similar markers in different color schemes, I tried to search around but no luck. Thanks in advance.

1 Answers

To recognize similar images with different colour scheme in ARKit or in RealityKit is a bad idea from the very beginning.

  • At first, please take into consideration that ARReferenceImage is a set. Swift's set is unordered collection of UNIQUE values. If Apple engineers wanted to create ARReferenceImage as array they would do it. But it's a SET in every sense of this word – in images' names and visually.

     func referenceImages(inGroupNamed name: String, 
                                     bundle: Bundle?) -> Set<ARReferenceImage>?
    


  • Secondly, when implementing ARTrackable protocol (remember, ARImageAnchor conforms to ARTrackable), you shouldn't track similar images or repetitive structures as Apple suggests.

     @available(iOS 11.3, *)
     open class ARImageAnchor : ARAnchor, ARTrackable {
    
         open var referenceImage: ARReferenceImage { get }
    
         @available(iOS 13.0, *)
         open var estimatedScaleFactor: CGFloat { get }
     }
    

    Watch ARKit WWDC 2018 video (Time 37:40) for details.


  • Thirdly, iPhone's neural engine perceives ARKit's and RealityKit's reference images in the black-and-white spectrum. I think it's made for two main reasons: one – Luma-contrast is more important than Chroma-contrast, and second – image recognition doesn't depend on environment light color – whether it's yellowish or blueish – the recognition's result should be unaltered.

    Do you guess what ARKit sees, looking at three similar images with different colour scheme?

enter image description here

The differences between green and cyan images are subtle.

Related