Assign to a single channel of GpuMat

asked 2020-07-21 12:05:21 -0600

rgov gravatar image

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?

edit retag flag offensive close merge delete


Seems that cv2.cuda.merge is probably on the right track.

rgov gravatar imagergov ( 2020-07-21 12:52:56 -0600 )edit