Multiple single channel matrix converted to single multi channel matrix

后端 未结 1 2010
一个人的身影
一个人的身影 2021-01-23 00:56

i am working in opencv c++ api with matrices

I have 4 single channel Mat that i will like to merge into one 4 channel matrix. It is basically the rgba channels i have in

相关标签:
1条回答
  • 2021-01-23 01:31

    You can use cv::merge to do what you want. One possible usage:

    cv::Mat r,g,b,a;
    
    //Fill r,g,b,a with data
    
    cv::Mat result;
    std::vector<cv::Mat> channels;
    
    channels.push_back(r);
    channels.push_back(g);
    channels.push_back(b);
    channels.push_back(a);
    
    cv::merge(channels, result);
    
    0 讨论(0)
提交回复
热议问题