unsharpMask()
Increases an image’s contrast between two colors.
Declaration
class func unsharpMask() -> any CIFilter & CIUnsharpMaskReturn Value
The modified image.
Discussion
This method applies the unsharp mask filter to an image. The effect increases the contrast of the edge between pixels of different colors within the defined radius property.
The unsharp mask filter uses the following properties:
inputImageAn image with the type CIImage.
radiusA
floatrepresenting the area of effect as an NSNumber.intensityA
floatrepresenting the desired strength of the effect as an NSNumber.
The following code creates a filter that results in the objects within the image becoming darker:
func unsharp (inputImage: CIImage) -> CIImage? {
let unsharpMask = CIFilter.unsharpMask()
unsharpMask.inputImage = inputImage
unsharpMask.radius = 5
unsharpMask.intensity = 2.5
return unsharpMask.outputImage!
}[Image]