Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assign to a single channel of GpuMat

I have some code which generates separate grayscale images, and then I composite them into the red, green, and blue channels of a color image, like so:

combined = numpy.zeros((frame.shape[0], frame.shape[1], 3)
combined[...,2] = red_img
combined[...,1] = green_img
combined[...,0] = blue_img

I'm updating the code to use the CUDA backend and so instead of using a Numpy array I need to create a cuda_GpuMat instance. However, these are 2D only.

What is the recommended solution to copy to only one channel?