Main Content

imsplit

Split multichannel image into its individual channels

Description

[c1,c2,c3,...,ck] = imsplit(I) returns a set of k images representing the individual channels in the k-channel image I.

example

Examples

collapse all

Read an RGB image into the workspace and display the image.

I = imread('peppers.png');
imshow(I)

Figure contains an axes object. The hidden axes object contains an object of type image.

Split the image into its component red, green, and blue channels.

[r,g,b] = imsplit(I);

Display the three color channels as a montage. Red peppers have a signal predominantly in the red channel. Yellow and green peppers have a signal in both the red and green channels. White objects, such as the garlic in the foreground, have a strong signal in all three channels.

montage({r,g,b},'Size',[1 3])

Figure contains an axes object. The hidden axes object contains an object of type image.

Read an RGB image into the workspace and display the image.

rgbImage = imread('peppers.png');
imshow(rgbImage)

Figure contains an axes object. The hidden axes object contains an object of type image.

Convert the RGB image to the HSV colorspace by using the rgb2hsv function.

hsvImage = rgb2hsv(rgbImage);

Split the HSV image into its component hue, saturation, and value channels.

[h,s,v] = imsplit(hsvImage);

Display the three channels as a montage.

montage({h,s,v},'Size',[1 3])

Figure contains an axes object. The hidden axes object contains an object of type image.

Input Arguments

collapse all

Input image, specified as an m-by-n-by-k numeric array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Output Arguments

collapse all

Output images, returned as k individual numeric matrices, where k is the number of channels in the input image. The output images are the same class as the input image.

Extended Capabilities

Version History

Introduced in R2018b

expand all

Go to top of page