#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2\opencv.hpp>
using namespace cv;
using namespace std;int main()
{vector<Mat>cha;Mat b, g, r,dst;//1.加载两幅图片Mat src = Mat(2,2,CV_8UC3);src = Scalar(100, 200, 255);//分离前的矩阵cout << "分离前的矩阵: " << endl << src << endl;//分离3通道放入vector对象中split(src, cha);b = cha.at(0);g = cha.at(1);r = cha.at(2);//验证是否分离cout << "分离后的B: " << endl<<b << endl;cout << "分离后的G: " << endl<<g << endl;cout << "分离后的R: " << endl<<r << endl;//合并后的矩阵merge(cha, dst);cout << "合并后的矩阵: " << endl << dst << endl;system("pause");return 0;
}