问题
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 4 matrices and want to combine into one rgba image/matrix. Anyone who knows how to do that?
回答1:
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);
来源:https://stackoverflow.com/questions/13648567/multiple-single-channel-matrix-converted-to-single-multi-channel-matrix