ARKIT相机Feed中的渐变失真效果

时间:2019-04-25 05:33:15

标签: ios swift4 arkit sceneview

我试图在Swift 4的ARSCNView中创建扭曲渐变效果。 我从下面得到了示例的黑白效果。

  func session(_ session: ARSession, didUpdate frame: ARFrame) {

    if blackAndWhite{

        //Convert The Current Frame To Black & White
        guard let currentBackgroundFrameImage = augmentedRealityView.session.currentFrame?.capturedImage,
            let pixelBufferAddressOfPlane = CVPixelBufferGetBaseAddressOfPlane(currentBackgroundFrameImage, 1) else { return }

        let x: size_t = CVPixelBufferGetWidthOfPlane(currentBackgroundFrameImage, 1)
        let y: size_t = CVPixelBufferGetHeightOfPlane(currentBackgroundFrameImage, 1)
        memset(pixelBufferAddressOfPlane, 128, Int(x * y) * 2)
    }

}

提前谢谢。

0 个答案:

没有答案