ColorSeparate

ColorSeparate[image]

gives a list of single-channel images corresponding to each of the color channels in image.

ColorSeparate[image,colorspace]

gives a list of images corresponding to the components of colorspace.

ColorSeparate[image,channel]

returns a single-channel image containing the specified channel.

Details

  • ColorSeparate is typically used to separate a multichannel image into single-channel images or to extract a specific color channel such as the red channel or the alpha channel.
  • ColorSeparate[image,{c1,c2,}] extracts the specified color components.
  • ColorSeparate works with arbitrary 2D and 3D images.
  • The following colorspace specifications can be given:
  • "RGB"red, green, blue
    "RGBA"red, green, blue, alpha
    "CMYK"cyan, magenta, yellow, black
    "HSB"hue, saturation, brightness
    "XYZ"channels of the CIE XYZ color space
    "LAB"channels of the CIE Lab color space
    "LCH"channels of the CIE LCH color space
    "LUV"channels of the CIE LUV color space
  • The channel specification can be one of the following:
  • "I"gray-level (intensity)
    "L"luminance channel of Lab
    "R","G","B"red, green, blue from RGB
    "C","M","Y","K"cyan, magenta, yellow, black from CMYK
    "H","S","V"hue, saturation, brightness (value) from HSB
    "Average"mean of all channels
    "A"alpha channel

Examples

open allclose all

Basic Examples  (2)

Separate an RGB image into three channels:

Separate the channels of a 3D image:

Scope  (6)

By default, an image is separated into the channels of its native color space. Red, green and blue channels of an RGB image:

Hue, saturation and brightness of the image converted to the HSB space:

Extract the blue channel:

Extract the luminance channel:

Compare color separation in different color spaces:

Extract the luminance channel of a 3D color image:

Show the four channels of a 3D color image in CMYK space:

Applications  (6)

Extract red objects by subtracting the blue and green color planes from the red color plane:

Colorize separated channels:

Segment foreground from background by thresholding the saturation values:

Display an RGB image using eight colors only:

Convert a color image to grayscale by selecting the maximum channel value of each pixel:

Compute the gradient of a multichannel image using three different methods:

Properties & Relations  (3)

The luminance of an image in RGB and Lab color spaces is the same:

The average pixel value of an RGB image and the luminance value are different:

Compare luminance-related channels in three different color spaces:

The "V" and "K" channel values are negatives of each other:

Separating colors of an image in a space is equivalent to color separation after converting to that space:

Introduced in 2008
 (7.0)
 |
Updated in 2010
 (8.0)
2012
 (9.0)
2014
 (10.0)