当前位置:网站首页>Opencv learning notes -- Separation of color channels and multi-channel mixing

Opencv learning notes -- Separation of color channels and multi-channel mixing

2022-06-24 12:05:00 cc_ rong

Catalog

Separate the color channels

Multichannel mixing


Separate the color channels

Separate channel function :split()        take The multi-channel array is separated into several single channel arrays

void split(const Mat& src, Mat*mvbegin);

Parameters 1:onst Mat& Type of src, Separate multichannel arrays

Parameters 2: Output array or output vector Containers .

According to the effect :

 

Code :

Mat srcImg1;
vector<Mat> channel;

srcImg1 = imread("E:\\img\\logo6.png");
	
split(srcImg1, channel);

imshow(" Source graph srcImg1", srcImg1);
imshow(" Blue weight ", channel.at(0));
imshow(" Green component ", channel.at(1));
imshow(" Red component ", channel.at(2));

Color channel RGB, stay opencv In Chinese, it means BGR    B: blue    G: green     R: red

Multichannel mixing

Multi channel mixing is the merging of multiple channels .

merge() function       Combine multiple arrays into a multi-channel array .

void merge(InputArrayOfArrays  mv,  OutputArray  dst)

     

Parameters 1,mv. The merged input matrix or vector Array of containers , In this parameter All matrices must be the same                   Size and depth .

Parameters 2,dst. Output matrix , and mv[0] Have the same size and depth , And the number of channels is in the matrix array                   Total number of channels .

      

原网站

版权声明
本文为[cc_ rong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241000269242.html