noiseReduction()
Reduces noise by sharpening the edges of objects.
Declaration
class func noiseReduction() -> any CIFilter & CINoiseReductionReturn Value
The blurred image.
Discussion
This method applies the noise reduction filter to an image. The effect calculates changes in luminance below the noise level and locally blurs the area. Values above the threshold are determined to be edges, and become sharpened.
The morphology noise reduction filter uses the following properties:
noiseLevelA
floatrepresenting the amount of noise reduction as an NSNumber.sharpnessA
floatrepresenting the sharpness of the final image as an NSNumber.inputImageA CIImage representing the input image to apply the filter to.
The following code creates a filter that reduces noise in the input image:
func noiseReduction(inputImage: CIImage) -> CIImage? {
let noiseReductionfilter = CIFilter.noiseReduction()
noiseReductionfilter.inputImage = inputImage
noiseReductionfilter.noiseLevel = 0.2
noiseReductionfilter.sharpness = 0.4
return noiseReductionfilter.outputImage
}[Image]