ios - 使用 ARKit 3.0 一次最多只能检测和跟踪 4 张图像

标签 ios objective-c swift augmented-reality arkit

使用下面的代码,我在使用 ARKit 时一次最多只能检测和跟踪 4 张图像。

ARImageTrackingConfiguration *configuration = [ARImageTrackingConfiguration new];  
configuration.trackingImages = [ARReferenceImage referenceImagesInGroupNamed:@"AR Resources" bundle:nil];  
configuration.maximumNumberOfTrackedImages = 100;  
[self.sceneView.session runWithConfiguration:configuration]; 

有人能证实我所看到的吗?我需要能够跟踪更多的图像/标记,当我在 ARKit 3 公告中看到这一功能时感到很兴奋。

如果有人能够复制这个就太好了,所以我知道我不是在想象事情 ^^

我希望这不是 Apple 的限制,8 年前 3DS 可以检测和跟踪超过 4 张图像。

最佳答案

更新:2022 年 7 月 18 日。

ARKit 6.0+

Apple promise 从 ARKit 5.0 开始,您将能够同时跟踪多达 100 张图像。

ARKit 4.0 及更早版本

在 ARKit 4.0 中,您最多可以同时跟踪 4 张图像。不超过四个。

尽管 ARKit 3.0 官方文档说 .maximumNumberOfTrackedImages 实例属性可以等于 100,但这百张图片只是 session 中跟踪图片的总数. Apple 软件工程师将图像跟踪功能限制为一次四张图像。这是有道理的,因为一次跟踪四个以上的图像会非常消耗 CPU 和 GPU。

Also, you can read about it here.

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    ARWorldTrackingConfiguration *config = [ARWorldTrackingConfiguration new];
    config.detectionImages = [ARReferenceImage referenceImagesInGroupNamed:@"Resources" bundle:nil];

    config.maximumNumberOfTrackedImages = 100;       // in ARKit 3.0
    // config.maximumNumberOfTrackedImages = 25;     // in ARKit 2.0

    [self.sceneView.session runWithConfiguration:config];
}

关于ios - 使用 ARKit 3.0 一次最多只能检测和跟踪 4 张图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56816333/

相关文章:

ios - Iphone, iPad 屏幕尺寸以编程方式纵向和横向模式

ios - 在 Swift 中调用串行队列中的函数

objective-c - QLPreviewController.currentPreviewItemIndex 键值观察

swift - 检查 AVAudioPlayer 是否正在播放

ios - Swift:如何获取Parse的许多用户的姓名和照片

ios - 限制解析查询

ios - 在 View Controller segue 之间传递数据

ios - 如何缩放和居中 UIBezierPath?

ios - 将委托(delegate)分配给 View Controller 以外的其他对象时未调用 SFSafariViewControllerDelegate 方法

objective-c - 记住 performSelector : for later in Objective-C