相关疑难解决方法(0)

我可以将CIFilter应用于ARkit相机Feed吗?

我正在尝试将模糊效果应用于ARSCNView中的相机实时蒸汽图像.我查看了WWDC视频.他们只提到了Metal的自定义渲染,但我没有在网上找到任何完整的例子.知道怎么做吗?


更新1我试图将过滤器应用于后台.它显示不正确的方向.我怎样才能解决这个问题?

let bg=self.session.currentFrame?.capturedImage

        if(bg != nil){
            let context = CIContext()
            let filter:CIFilter=CIFilter(name:"CIColorInvert")!
            let image:CIImage=CIImage(cvPixelBuffer: bg!)
            filter.setValue(image, forKey: kCIInputImageKey)
            let result=filter.outputImage!
            self.sceneView.scene.background.contents = context.createCGImage(result, from: result.extent)

        }
Run Code Online (Sandbox Code Playgroud)

cifilter ios11 arkit

5
推荐指数
2
解决办法
1831
查看次数

标签 统计

arkit ×1

cifilter ×1

ios11 ×1