【发布时间】:2020-09-04 03:43:24
【问题描述】:
目前我正在使用 ARKit/CoreML/Vision 来识别图像/对象。
为此,我查看了 Apple 的示例项目 Recognizing and Labeling Arbitrary Objects
我已将 ViewController.Swift 脚本中的以下几行复制到我的项目中:
private func classifyCurrentImage() {
// Most computer vision tasks are not rotation agnostic so it is important
// to pass in the orientation of the image with respect to device.
let orientation = CGImagePropertyOrientation(UIDevice.current.orientation)
}
这里是 CGImagePropertyOrientation 类型的常量。
当我尝试将设备方向线作为参数传递时,它会出错。由于 CGImagePropertyOrientation 需要一个 UInt32 类型的值而不是 UIDeviceOrientation
编译器错误输出:
// Cannot convert value of type 'UIDeviceOrientation' to expected argument type 'UInt32'
我认为错误出在此处UIDevice.current.orientation
【问题讨论】:
标签: swift arkit coreml apple-vision