I would like to create following 2x2 image from numpy array using OpenCV.
I tried to create it with this code snippet.
import cv2
import numpy as np
blue = (255, 0, 0)
green = (0, 255, 0)
red = (0, 0, 255)
image = np.array([
[blue, green],
[red, blue]
])
cv2.imwrite('2x2.jpg', image)
I used BGR color format, yet when I view the output image, I see a colorless image.
What am I missing?
Environment
- OpenCV 4.5.1.48
- Python 3.9.1
- Windows 10