小编Sai*_*aif的帖子

如何在实时跟踪中将 3D 对象包裹在检测到的对象周围

我已经为脚创建了 ML 模型作为 VNRecognizedObjectObservation 现在我能够成功地在实时跟踪中检测脚,问题是我无法将 3D 对象包裹或放置在脚上,因为我需要 3 个坐标来放置 AR 内容。

我使用下面的代码在视觉框架检测到我的脚后获取边界框

func drawVisionRequestResults(_ results: [Any]) {
        CATransaction.begin()
        CATransaction.setValue(kCFBooleanTrue, forKey: kCATransactionDisableActions)
        detectionOverlay.sublayers = nil // remove all the old recognized objects

        let obs = results.first
        let final = obs

        for observation in results where observation is VNRecognizedObjectObservation {
            guard let objectObservation = observation as? VNRecognizedObjectObservation else {
                continue
            }
            // Select only the label with the highest confidence.
            let topLabelObservation = objectObservation.labels[0]
            let objectBounds = VNImageRectForNormalizedRect(objectObservation.boundingBox, Int(bufferSize.width), Int(bufferSize.height))

            let shapeLayer …
Run Code Online (Sandbox Code Playgroud)

image-recognition swift apple-vision arkit coreml

5
推荐指数
0
解决办法
426
查看次数

标签 统计

apple-vision ×1

arkit ×1

coreml ×1

image-recognition ×1

swift ×1