nprof50
nprof50

Reputation: 61

Using ARKit to capture high quality photos

I am interested in using ARKit's ability to track the phone's position to automatically take photos using the camera. My initial investigation led to me to understand that while ARKit is using the camera, it is not possible to get high-quality images using the standard AVFoundation methods (due to the camera being in use).

I understand I can use sceneView.snapshot(), but the best quality this can provide is 1080p, which isn't high enough quality to use for my application.

My question is, are there any other methods for capturing a high-quality photo from the back-facing camera while an ARSession is running? If not, are there any alternatives to ARKit for estimating the position of the phone?

Upvotes: 6

Views: 2460

Answers (1)

Harrison Friia
Harrison Friia

Reputation: 384

This probably won't get you the resolution you're looking for, but I have noticed that using the currentFrame.capturedImage property on the ARSession yields a higher resolution image than sceneView.snapshot().

Here's an example using the debugger on my iPhone 7:

(lldb) po sceneView.snapshot()
<UIImage: 0x282331180>, {750, 1334}

(lldb) po UIImage(pixelBuffer: session.currentFrame.capturedImage)
▿ Optional<UIImage>
  - some : <UIImage: 0x282331e30>, {1920, 1440}

The resolution will probably vary based on your hardware.

Another thing to check is if you're overriding the videoFormat property of your ARConfiguration. You can check which video formats are supported for your device with ARWorldTrackingConfiguration.supportedVideoFormats.

Upvotes: 4

Related Questions