Ask Your Question

Revision history [back]

I solved this using cv::transform(), see the example below to extend the single_channel image to n channels.

cv::Mat broadcast = cv::Mat::ones(n, 1, single_channel.depth());
cv::Mat extended;
cv::transform(single_channel, extended, broadcast);

See cv::transform().