opencv4学习总结-图像通道合并与分离

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;


int main()
{
    Mat src = imread("E:/opencv_source/opencv_tutorial_data-master/images/flower.png");
    imshow("src", src);
    vector<Mat> mv;
    //分离
    split(src, mv);
    int size = mv.size();
    printf("number of channels:%d\n", size);
    imshow("blue channel", mv[0]);
    imshow("green channel", mv[1]);
    imshow("red channel", mv[2]);

    //合并
    Mat dst;
    merge(mv, dst);
    imshow("merge", dst);


    waitKey(0);
    destroyAllWindows();

    return 0;
}