Ask Your Question

Revision history [back]

Broadcast single channel to N-channels

Is there an OpenCV function to take a single channel image and extend it to N-channels, copying/repeating the pixel value to all channels, something like a pixel-wise broadcast?

I need to be able to per-element multiply a single channel image with an n-channel image and the only way to do this with high-level function calls is to extend/repeat the single channel image to match the dimensions of my n-channel image. Can I achieve this with a cv::Mat from cv::Mat::reshape() passed to cv::repeat()? Can I achieve this with cv::transform()?