【发布时间】:2018-05-13 16:55:06
【问题描述】:
我正在使用以下函数来模糊具有深度图的图像,并注意到过滤器在最终结果图像周围创建了一个边框。我不确定我做错了什么导致了这个。
func blur(image: CIImage, mask: CIImage,orientation: UIImageOrientation = .up) -> UIImage? {
let invertedMask = mask.applyingFilter("CIColorInvert")
let output = image.applyingFilter("CIMaskedVariableBlur", parameters: ["inputMask" : invertedMask,"inputRadius": 15.0])
guard let cgImage = context.createCGImage(output, from: output.extent) else {
return nil
}
return UIImage(cgImage: cgImage, scale: 1.0, orientation: orientation)
}
【问题讨论】: