Load ARReferenceImage from dropbox

I would like to load my detectionImages from dropbox. The route I've chosen is to load the image using CGImageCreate and then change it to an ARReferenceImage with initWithCGImage.


I add the ARReferenceImage to a NSMutableSet<ARReferenceImage *>


When I assign this set to configuration.detectionImages it fails to recognize the images.


When I store the same images in Assets.xcassets and load them with referenceImagesInGroupNamed then they do get recognized and it all works fine.


The documentation states that xcode does some preprocessing to the images. I suspect that this is what would be missing when I load the images on the fly.

But then I wonder what is the use of having the option to generate an ARReferenceImage with initWithCGImage.


Can someone point me in the right direction?

Replies

"Yes it should do the same preprocessing: Adjusting the size and converting it to greyscale." and by 'it' we mean both of the approaches that you have mentioned (so image preprocessing is always done regardless of which approach you choose).

Thanks very much. Got it working now.

Hi Koos, would you mind putting some sample lines of code online showing how you got it working... obviously some pre-processing needed as described by 4k4 but been unable to find what specifically this preprocessing needs to be....

Thanks in advance

Regards

Graeme

It's unclear what kind of pre-processing is involved. Can you please elaborate?

To be clear "Yes it should do the same preprocessing: Adjusting the size and converting it to greyscale." is preprocessing done either by Xcode's asset catelog or ARReferenceImage's initWithCGImage i.e. this is something done for you and requires no action on your part.