# Revision history [back]

### Most efficient copying of a single channel to multi channel image

What I am looking for is the most efficient way of copying a one channel image into all the channels of a multi channel image. Or another approach to achieve the same.

This is what I have now (this example uses a fixed number of 5 channels):

cv::Mat singleChannel;
std::vector<cv::Mat> vChannels;
for (unsigned int c = 0; c < 5; c++)
{
vChannels.push_back(singleChannel);
}
cv::Mat result;
cv::merge(vChannels, result);


Ultimately I wish to get rid of the merge...