olexale / arkit_flutter_plugin

ARKit Flutter Plugin
MIT License
797 stars 225 forks source link

Loading image assets dynamically #49

Closed istornz closed 4 years ago

istornz commented 4 years ago

Hello, First, thanks for this awesome plugin !

I had a question, is it possible to load dynamically image assets in the app ? To be more clear, I want to use the widget projection & Image detection features but I can't load the asset directly in the bundle. Indeed, I want to detect images downloaded directly from the app, so images are not know at advance and can't be added to the project...

Is there already possible ?

Thanks in advance.

olexale commented 4 years ago

Hi! Thank you!

This is not possible for now, but I can add this functionality. In your case, will the app know which images need to be detected during the scene initialization?

istornz commented 4 years ago

Hi @olexale ! Thanks for your reply. I'm very hyped to see this feature :)

In my case, the image was downloaded before the scene initialization but not included in the app bundle.

Thanks in advance !

olexale commented 4 years ago

Hi again! Please check the "Network Image Detection" sample. It freezes a bit during initialization and anchor creation as network loading operation works synchronously. Still should work. 🙂

istornz commented 4 years ago

Hi ! Thanks for your awesome work, it's work great ! I just noticed a bug (maybe ?):

I tried to test this new feature inside the widget_projection.dart, so I just replaced trackingImagesGroupName by detectionImages array like the network_image_detection example but nothing append... Did I miss something ?

Current code in widget_projection.dart ARKitSceneView( trackingImagesGroupName: 'AR Resources', onARKitViewCreated: onARKitViewCreated, worldAlignment: ARWorldAlignment.camera, configuration: ARKitConfiguration.imageTracking, ),

modified by

ARKitSceneView( detectionImages: const [ ARKitReferenceImage( name: 'MY_WORKING_IMAGE_URL', physicalWidth: 0.2, ), ], onARKitViewCreated: onARKitViewCreated, worldAlignment: ARWorldAlignment.camera, configuration: ARKitConfiguration.imageTracking, ),

BTW thanks again, this feature is awesome ! Best regards,

olexale commented 4 years ago

You used ARKitConfiguration.imageTracking configuration, hence trackingImages should be used instead of detectionImages. Thanks! 🙂

istornz commented 4 years ago

Exactly but it seems to not work too... I tried with a fresh clone of the example (widget_projection) and just replace:

trackingImagesGroupName: 'AR Resources',

by

trackingImages: const [ ARKitReferenceImage( name: 'https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/OSIRIS_Mars_true_color.jpg/800px-OSIRIS_Mars_true_color.jpg', physicalWidth: 0.2, ), ],

Did I miss something again ? Thanks again for your time !

olexale commented 4 years ago

Ah, right. There was a misprint. Should be fixed now, please check.

istornz commented 4 years ago

This is perfect ! Thanks a lot !