- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在 iOS SDK iOS 11.3 测试版、xCode 9.3 测试版中,ARKit 1.5 为我们提供了 possibility以与我们使用 ARToolKit 或 Vuforia 相同的方式通过相机跟踪引用图像。
问题是,我能否跟踪完全相同的引用图像的条目数,并在每个图像的顶部放置一些形状,就好像它们是单独的项目一样? documentation状态:
When you run a world-tracking AR session and specify ARReferenceImage objects for the session configuration's detectionImages property, ARKit searches for those images in the real-world environment. When the session recognizes an image, it automatically adds to its list of anchors an ARImageAnchor for each detected image.
我能够为我的 ARWorldTrackingConfiguration 提供三个完全相同的图像(但旋转不同),但它只找到第一个命中图像(它们以类似矩阵的 View 打印在一张纸上)。这是否意味着我只能跟踪每个唯一引用图像的首次点击?
如果我们有 anchor 列表,我们可以尝试计算这是否不是同一个精确点,并可能尝试强制它进一步搜索?
我们将不胜感激。
最佳答案
我很确定不可能直接开箱即用地跟踪同一图像的多次出现,因为当检测到图像时,它会被赋予一个 ARImageAnchor 并且这只会发生一次:
If your AR experience adds virtual content to the scene when an image is detected, that action will by default happen only once. To allow the user to experience that content again without restarting your app, call the session’s remove(anchor:) method to remove the corresponding ARImageAnchor: After the anchor is removed, ARKit will add a new anchor the next time it detects the image.
话虽如此,您可以通过使用此内置函数在特定时间段后手动删除图像的 ARImageAnchor 来跟踪图像显示的次数:
func remove(anchor: ARAnchor)
不过,如果您同时在相机的前端有相同的图像,我认为这不会起作用。
撇开所有的事情不谈,希望这个例子能对你有所帮助......
创建两个变量(一个用于存储检测计数,一个用于存储 anchor ):
var anchors = [ARImageAnchor]()
var countOfDetectedImages = 0
然后:
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
//1. If Out Target Image Has Been Detected Than Get The Corresponding Anchor
guard let currentImageAnchor = anchor as? ARImageAnchor else { return }
//2. Store The ARImageAnchors
anchors.append(currentImageAnchor)
//3. Get The Targets Name
let name = currentImageAnchor.referenceImage.name!
print("Image Name = \(name)")
//4. Increase The Count If The Reference Image Is Called Target
if name == "target"{
countOfDetectedImages += 1
print("\(name) Has Been Detected \(countOfDetectedImages)")
//6. Remove The Anchor
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
self.augmentedRealitySession.remove(anchor: anchor)
}
}
}
对于变量的完全重置:
/// Removes All The ARImageAnchors & The Detected Count
func removeAllAnchorsAndResetCount(){
countOfDetectedImages = 0
anchors.forEach{ augmentedRealitySession.remove(anchor: $0) }
anchors.removeAll()
}
可能的解决方法:
仅供引用,Apple Documentation
中有一些注释它具有以下初始化方法:
init(CGImage, orientation: CGImagePropertyOrientation, physicalWidth: CGFloat):
从 Core Graphics 图像对象创建新的引用图像。
init(CVPixelBuffer, orientation: CGImagePropertyOrientation, physicalWidth: CGFloat)
从 Core Video 像素缓冲区创建新的引用图像。
所以“也许”,我还没有研究过这个,你也许可以那样处理方向?
关于ios - 可以在 iOS 11.3 beta、xCode 9.3 beta、ARKit 1.5 上跟踪同一 ARReferenceImage 的多个条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49069512/
我正在观看来自 iTunes U. 的视频讲座,其中讲师展示了如何使用 Xcode 的调试器部分并能够将该窗口从主窗口拉开。 不幸的是,视频显示了如何在 Xcode3 中执行此操作的说明。如何在 Xc
现在我正在开发一个使用 Markdown 的静态网站。我不想在 SublimeText 中编辑文件,而是想在 Xcode 中编辑它们。我可以在 Xcode 中打开各个文件,但我想打开整个静态站点目录并
现在我正在开发一个使用 Markdown 的静态网站。我不想在 SublimeText 中编辑文件,而是想在 Xcode 中编辑它们。我可以在 Xcode 中打开各个文件,但我想打开整个静态站点目录并
我真的厌倦了其他用户的项目错误,因为 XCode 的默认类引用类型是“相对于 XCode 文件夹”。我知道您可以将其更改为“相对于封闭组”,这就是我们的项目,但是任何时候有人创建一个新的类文件并且忘记
我对 Xcode 一无所知,除了它是来自 Apple 的开发人员界面,它实际上来自 OSX CD,它也用于创建 iPhone 应用程序。 我也知道它有一个 Applications 文件夹,里面装满了
更新 Xcode(从 7.2 到 7.2.1)后,XcodeServer 无法运行 Xcode Service。当我选择更新的 Xcode 时,提示消息:Enable Accessibility ac
我很难找到有关新 XCode 布局的信息。如何查看源文件的反汇编,而不仅仅是 C++ 代码? 最佳答案 在 Xcode 4.2(和 Xcode 5)中,您可以通过以下方式查看文件的汇编或反汇编: 显示
我在 XCode 中为我的项目添加了一个文件夹并将其命名为 Themes,它将用于存储我的 iPad 应用程序的主题。在那下面我有红色、蓝色等等。 它们出现在 XCode 中。但是当我查看物理文件夹时
作为我之前 How can I create a reference cycle using dispatchQueues? 的后续: 对于强引用(会造成泄漏,但不是循环引用),例如Timer、Dis
我有一台 macbook air,我去商店安装 Xcode 7.3 并点击更新 App 按钮,然后出现了一个加载图标,但等待 30 分钟后什么也没发生。我从商店成功安装了 simple recorde
我的项目现在有一个project.xcworkspace/xcshareddata目录。 Xcode在project.xcworkspace/xcshareddata目录中存储什么? 最佳答案 xcs
我不经常使用 XCode 进行开发,最近 MacPorts 告诉我我需要获得 3.1 才能使包工作。我去了苹果,他们为我提供了最新版本,结果只适用于 OSX 6。因为我有 OSX 5,它对我没有任何帮
有谁知道如何强制 Xcode 停止运行。我更新到 6.2 但现在它不能正常工作。我需要退出 Xcode 才能完成更新或卸载并重新安装。菜单中的相当 Xcode 不可用。无法将其拖到垃圾箱,因为它说它仍
我最近从我的项目中删除了一些旧的测试类并删除了文件。正如预期的那样,文件被移到垃圾箱并在 git 中显示为已删除。 不幸的是,测试类和它们定义的测试用例继续出现在测试导航器中。我已经尝试过常见的疑点,
Xcode 中的场景编辑器显示大小但不显示单位。它是以英寸为单位的尺寸还是以米为单位的尺寸? 例如,当我选择一个节点时,例如一个盒子,当我在节点检查器中检查它的属性并在“边界框”旁边的“变换”部分检查
只想知道 xcode 项目中事件可执行文件的目的是什么? 谢谢 索拉布 最佳答案 自己找到了..希望它会帮助某人。 您可以在其中运行和测试软件产品的可执行环境。可执行环境定义了应该用来运行产品的程序。
刚回到我的办公 table ,Xcode 一直在文件中突出显示/强调空白区域。如果我输入一些东西它就会消失,但如果我切换标签并回来,它们会重新出现。 更新:这不是由“显示隐形”选项引起的。那看起来不一
我首先注意到这一点 Cmd-/偶尔拒绝为注释取消注释的代码行工作。但是现在(刚刚使用 XCode 4.1,虽然这可能无关)它发生在 Cmd-B建立。 我无法弄清楚我正在做什么导致这种情况,或者是否有任
我不太了解Xcode 4的工作区的实用程序。它们的用途是什么,它们如何帮助Xcode进行开发? 最佳答案 例如。您有一个在两个应用程序中使用的库。您很可能为此库拥有一个自己的项目,对吗?现在,您可以自
我正在关注一个应用程序教程,它说: “接下来,在 Xcode 应用程序项目目录的根目录下创建一个空文件,并调用该文件 Podfile。使用您喜欢的文本编辑器打开它,然后在其中粘贴以下行:” 我很困惑这
我是一名优秀的程序员,十分优秀!