I have an image with 3 channels (img) and another one with a single channel (ch1).
Mat img(5,5,CV_64FC3); Mat ch1 (5,5,CV_64FC1);
I
There is a function called cvMixChannels. You'll need to see implementation in the source code, but I bet it is well optimized.