convertRGBtoLab()
Converts an image from RGB to CIELAB color space.
Declaration
class func convertRGBtoLab() -> any CIFilter & CIConvertLabReturn Value
The converted CIImage.
Discussion
This filter converts an image from RGB to CIELAB color space. The CIELAB color space expresses color as three values: L* for the perceptual lightness, and a*b* for the colors red, green, blue, and yellow. The RGB color space expresses colors using the intensities of the three primary colors: red, green, and blue.
inputImageA CIImage containing the
RGBimage.normalizeIf true, the three output channels are in the range 0 to 1. If false, the L* channel is in the range 0 to 100 and the a*b* channels are in the range -128 to 128.
The following code applies the convertRGBToLabFilter to an image with the normalize flag set to the true:
func convertRGBToLab(inputImage: CIImage) -> CIImage {
let convertRGBToLabFilter = CIFilter.convertRGBtoLab()
convertRGBToLabFilter.inputImage = inputImage
convertRGBToLabFilter.normalize = true
return convertRGBToLabFilter.outputImage!
}[Image]