Ask Your Question

Revision history [back]

The following python code worked for me for white background. Thanks to Steven P.

DEFAULT_SIZE_WHITE_CHANNEL = (640, 480, 1)
white_channel_image = np.ones(DEFAULT_SIZE_WHITE_CHANNEL, dtype = "uint8") * 255

The image produced will have a single channel of size 640 x 480. You will get a white image. Merge it with different channels using cv2.merge() function to get a RGB image.