Contents

edgePreserveUpsample()

Creates a high-quality upscaled image.

Declaration

class func edgePreserveUpsample() -> any CIFilter & CIEdgePreserveUpsample

Return Value

The adjusted image.

Discussion

This method applies the edge preserve upsample filter to an image. The effect upsamples a small input image to be the size of the scale image using the luminance of the input image to preserve detail.

The edge preserve upsample filter uses the following properties:

inputImage

An image representing the image to upscale with the type CIImage.

scaleImage

An image representing the reference for scaling the input image with the type CIImage.

spatialSigma

A float representing the influence of the input image’s spatial information on the upsampling operation as an NSNumber.

lumaSimga

A float representing influence of the input image’s luma information on the upsampling operation as an NSNumber.

The following code creates a filter that upscales the smaller image to the size of the scale image:

func edgePerserveUp(inputImage: CIImage, smallImage: CIImage) -> CIImage {
    let edgePerserveUpFilter = CIFilter.edgePreserveUpsample()
    edgePerserveUpFilter.inputImage = inputImage
    edgePerserveUpFilter.smallImage = smallImage
    edgePerserveUpFilter.spatialSigma = 5
    edgePerserveUpFilter.lumaSigma = 0.15
    return edgePerserveUpFilter.outputImage!
}

[Image]

See Also

Filters