Instance Method

regionOfInterest(for:in:)

Returns the region of interest for the filter chain that generates the image.

Declaration

func regionOfInterest(for image: CIImage, in rect: CGRect) -> CGRect

Parameters

im

Another image that is part of the filter chain that generates the image.

r

A rectangle in the image’s coordinate space.

Return Value

A rectangle in the coordinate space of the input image (the im parameter).

Discussion

The region of interest is the rectangle containing pixel data in a source image (the im parameter) necessary to produce a corresponding rectangle in the output image. If the image is not the output of a filter (or of a chain or graph of several CIFilter objects), or the image in the im parameter is not an input to that filter, the rectangle returned is the same as that in the r parameter.

For example,

  • If the image is the output of a filter that doubles the size of its input image, the rectangle returned will be half the size of that in the r parameter. (Upscaling causes every pixel in the input image to correspond to multiple pixels in the output image.)

  • If the image is the output of a blur filter, the rectangle returned will be slightly larger than that in the r parameter. (In a blur filter, each pixel in the output image is produced using information from the corresponding pixel and those immediately surrounding it in the input image.)

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software