morphologyGradient()
Detects and highlights edges of objects.
Declaration
class func morphologyGradient() -> any CIFilter & CIMorphologyGradientReturn Value
The blurred image.
Discussion
This method applies the morphology gradient filter to an image. The effect uses the radius to compute and highlight edges of items within the image.
The morphology gradient filter uses the following properties:
radiusA
floatrepresenting the area of effect as an NSNumber.inputImageA CIImage representing the input image to apply the filter to.
The following code creates a filter that adds darkness to the overall image while the edges in the input photo become brighter:
func morphologyGradient(inputImage: CIImage) -> CIImage? {
let morphologyGradientFilter = CIFilter.morphologyGradient()
morphologyGradientFilter.inputImage = inputImage
morphologyGradientFilter.radius = 1
return morphologyGradientFilter.outputImage
}[Image]