lineOverlay()
Creates an image that resembles a sketch of the outlines of objects.
Declaration
class func lineOverlay() -> any CIFilter & CILineOverlayReturn Value
The modified image.
Discussion
This method applies the line overlay filter to an image. The effect creats a sketch that outlines the edges of the image in black, leaving the non-outlined portion of the image transparent.
The line overlay filter uses the following properties:
inputImageAn image with the type CIImage.
nrNoiseLevelA
floatrepresenting the desired level of noise as an NSNumber.nrSharpnessA
floatrepresenting the desired level of sharpness as an NSNumber.edgeIntensityA
floatrepresenting the Sobel gradient information for edge tracing as an NSNumber.thresholdA
floatrepresenting the threshold of edge visibilty as an NSNumber.contrastA
floatrepresenting the desired contrast as an NSNumber.
The following code creates a filter that results in a monochrome image with lines outlining the edges of objects:
func lineOverlay(inputImage: CIImage) -> CIImage {
let lineOverlay = CIFilter.lineOverlay()
lineOverlay.inputImage = inputImage
lineOverlay.nrNoiseLevel = 0.07
lineOverlay.nrSharpness = 0.71
lineOverlay.edgeIntensity = 1
lineOverlay.threshold = 0.1
lineOverlay.contrast = 50.00
return lineOverlay.outputImage!
}[Image]