OpenCV color separation

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )


A color channel

1. The channel separation: split ()

prototype

void split(
	InputArray m,
	OutputArrayOfArrays mv;
)

parameter

  • m: separating an image to be
  • mv: output channel of the container. Generally vector<Mat>container

Examples: separating three-channel

Mat srcIamge=imread();
vector<Mat> channels;
split(srcImage,channels);
//使用at()来得到BGR的
Mat dstImageBlue=channels.at(0);
Mat dstImageGreen=channels.at(1);
Mat dstImageRed=channels.at(2);

2. The channel merging merge ()

prototype

void merge(
	InputArrayOfArrays mv;
	OutputArray dst
)

parameter

  • mv: input channel container. Generally vector<Mat>container
  • dst: Image Synthesis

Examples: separating three-channel

Mat dstImage;
merge(channels,dstImage);

Guess you like

Origin blog.csdn.net/sandalphon4869/article/details/94713547