Most efficient copying of a single channel to multi channel image

asked 2014-09-02 10:42:47 -0600

boaz001 gravatar 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++)
cv::Mat result;
cv::merge(vChannels, result);

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

edit retag flag offensive close merge delete



stop worrying. the whole thing is an expensive copy, no matter what you use, it won't get faster.

berak gravatar imageberak ( 2014-09-02 12:10:44 -0600 )edit