通道分离与合并:
通道分离:split()函数:
合并:
merge()函数
#include"opencv2/opencv.hpp"
using namespace cv;
void main()
{
Mat img = imread("2.jpg");
vector<Mat> channels;
split(img,channels);
Mat blueChannel = channels.at(0);
Mat greenChannel = channels.at(1);
Mat redChannel = channels.at(2)
merge(channels,dst);
imshow("原图",img);
imshow("图片蓝色通道",blueChannel);
imshow("图片绿色通道",greenChannel);
imshow("图片红色通道",redChannel);
imshow("管道合并之后图像",dst);
waitKey(0);
}