iOS 11.3 ARKit自动对焦和更高分辨率

时间:2018-01-25 11:11:45

标签: ios arkit

如上所述here Apple允许我们在基于ArKit的应用程序中使用更高分辨率和自动对焦,是否有人已经尝试在自己的应用程序中实现这些功能? 苹果通常会分享有关此类更新的更多技术细节吗?

问候!

3 个答案:

答案 0 :(得分:2)

您无法设置ARCamera图像分辨率...这就是您可能找不到与调整相机图像分辨率相关的任何内容的原因。 Changing ARCamera Resolution

如果要检查ARCamera图像分辨率,可以通过currentFrame进行访问。

let currentFrame = sceneView.session.currentFrame
print(currentFrame?.camera.imageResolution)

到目前为止它被设置为1280.0,720.0

如果您想了解有关焦距的更多信息,我相信自动对焦现在可以自动调整。你可以检查currentFrame的camera属性。

print(currentFrame?.camera)

答案 1 :(得分:1)

好的,可以添加自动对焦: var isAutoFocusEnabled:Bool {get set}

var configuration = ARWorldTrackingConfiguration()
configuration.isAutoFocusEnabled = true // or false

有关更高分辨率的任何线索?

答案 2 :(得分:1)

我可以使用以下代码为AR摄像机选择所需的分辨率-

ARWorldTrackingConfiguration* configuration = [ARWorldTrackingConfiguration new];

NSArray<ARVideoFormat*>* supportedVideoFormats = [ARWorldTrackingConfiguration supportedVideoFormats];

int bestFormatIndex = 0;

for (int i = 0; i < [supportedVideoFormats count]; i++) {
    float width = supportedVideoFormats[i].imageResolution.width;
    float height = supportedVideoFormats[i].imageResolution.height;
    NSLog(@"AR Video Format %f x %f", width, height);
    if (width * 9 == height * 16) { // <-- Use your own condition for selecting video format
        bestFormatIndex = i;
        break;
    }
}

[configuration setVideoFormat:supportedVideoFormats[bestFormatIndex]];

// Run the view's session
[_mSceneView.session runWithConfiguration:configuration];

根据我的要求,我想要最大的16:9比例。在iPhone 8+上,列出了以下图像分辨率-

1920 x 1440
1920 x 1080
1280 x 720

请注意,它们按支持的VideoFormats数组排序,最大分辨率为0索引。并且0th索引是默认选择的视频格式。

相关问题