Type Method

motionBlurFilter

Creates motion blur on an image.

Declaration

+ (CIFilter<CIMotionBlur> *)motionBlurFilter;

Return Value

The blurred image.

Discussion

This method applies the motion blur filter to an image. The filter uses the angle of a single row of pixels to determine the direction of the motion effect.

The motion blur filter uses the following properties:

radius

A float representing the area of effect as an NSNumber.

angle

A float representing the angle of the motion, in radians, that determines which direction the blur smears as an NSNumber.

inputImage

A CIImage representing the input image to apply the filter to.

The following code creates a filter that adds a motion blur to the input image:

    func motionBlur(inputImage: CIImage) -> CIImage? {

        let motionBlurFilter = CIFilter.motionBlur()
        motionBlurFilter.inputImage = inputImage
        motionBlurFilter.angle = 0
        motionBlurFilter.radius = 20
        return motionBlurFilter.outputImage
    }
Two photographs of a beach at sunset with multiple palm trees. The photo on the left is clear and crisp. In the photo on the right, a motion blur filter has been applied, causing a hazy and streaky effect and making the trees in the foreground look very blurry and distorted.

See Also

Filters

+ bokehBlurFilter

Applies a bokeh effect to an image.

+ boxBlurFilter

Applies a square-shaped blur to an area of an image.

+ discBlurFilter

Applies a circle-shaped blur to an area of an image.

+ gaussianBlurFilter

Blurs an image with a Gaussian distribution pattern.

+ maskedVariableBlurFilter

Blurs a specified portion of an image.

+ medianFilter

Calculates the median of an image to refine detail.

+ morphologyGradientFilter

Detects and highlights edges of objects.

+ morphologyMaximumFilter

Blurs a circular area by enlarging contrasting pixels.

+ morphologyMinimumFilter

Blurs a circular area by reducing contrasting pixels.

+ morphologyRectangleMaximumFilter

Blurs a rectangular area by enlarging contrasting pixels.

+ morphologyRectangleMinimumFilter

Blurs a rectangular area by reducing contrasting pixels.

+ noiseReductionFilter

Reduces noise by sharpening the edges of objects.

+ zoomBlurFilter

Creates a zoom blur centered around a single point on the image.