olexale / arkit_flutter_plugin

ARKit Flutter Plugin
MIT License
800 stars 228 forks source link

save screenshot? #97

Closed sstadtl closed 4 years ago

sstadtl commented 4 years ago

is there any way to capture the AR scene from code? This https://pub.dev/packages/screenshot could not handle it.

olexale commented 4 years ago

Hi @sstadtl, You may use native_screenshot plugin by @ivanjpg for that.

sstadtl commented 4 years ago

this work beautiful. ty

leeprobert commented 3 years ago

That package will take a screenshot of the entire screen including any other widgets, app bars etc. Is there any way to grab the video frame from the ARKitSceneView? I would also like to just take the UI.Image data so I can allow my user to choose if they want to save it. I have tried RepaintBoundary technique but as pointed out, it doesn't seem to want to paint a video frame.

leeprobert commented 3 years ago

@olexale I'd like to reopen this ... that alternative is not ideal. Surely we can grab a frame from the video?

leeprobert commented 3 years ago

ARSession has a currentFrame getter that returns an ARFrame. This class has a capturedImage property which is a CVPixelBuffer ... it would take a bit of work, but it should be possible to allow access to the ARSession and then convert that CVPixelBuffer into a ByteArray so we can create an image of it.

leeprobert commented 3 years ago

Not clear if ARFrame contains the augmented content as well, or just the raw video data.

leeprobert commented 3 years ago

the snapshot method of ARSceneView works and I have added it to the package as a snapshot method of ARKitController. I'll submit a pull request.