Contents

lineOverlay()

Creates an image that resembles a sketch of the outlines of objects.

Declaration

class func lineOverlay() -> any CIFilter & CILineOverlay

Return 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:

inputImage

An image with the type CIImage.

nrNoiseLevel

A float representing the desired level of noise as an NSNumber.

nrSharpness

A float representing the desired level of sharpness as an NSNumber.

edgeIntensity

A float representing the Sobel gradient information for edge tracing as an NSNumber.

threshold

A float representing the threshold of edge visibilty as an NSNumber.

contrast

A float representing 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]

See Also

Filters