使用ARKit拍摄高质量的照片 [英] Using ARKit to capture high quality photos
问题描述
我对使用ARKit跟踪手机位置以使用相机自动拍照的功能感兴趣.最初的调查使我了解到,虽然ARKit使用相机,但无法使用标准AVFoundation方法(由于使用相机)来获得高质量的图像.
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).
我知道我可以使用sceneView.snapshot()
,但是它可以提供的最佳质量是1080p,这对于我的应用程序来说还不够高.
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.
我的问题是,在ARSession运行时,是否还有其他方法可以从后置摄像头捕获高质量照片?如果没有,ARKit是否有其他替代方法可以估算手机的位置?
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?
推荐答案
这可能无法为您提供所需的分辨率,但是我注意到在ARSession
上使用currentFrame.capturedImage
属性会产生一个分辨率比sceneView.snapshot()
高的图像.
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()
.
以下是在我的iPhone 7上使用调试器的示例:
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.
要检查的另一件事是,是否要覆盖ARConfiguration
的videoFormat
属性.您可以使用ARWorldTrackingConfiguration.supportedVideoFormats
检查设备支持的视频格式.
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
.
这篇关于使用ARKit拍摄高质量的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!