I would like to read camera image by opencv-python and send image raw data (byte array) in RGB565 format to device. Here are some testing codes:
import cv2
cam = cv2.VideoCapture(0) # open camera
flag, image = cam.read() # read image from camera
show = cv2.resize(image, (640, 480)) # resize to 640x480
show = cv2.cvtColor(show, cv2.COLOR_BGR2RGB) # convert to RGB888
After codes run, it returned "show" ndarray (numpy) by cvtColor at last line, the "show" ndarray info is:
>>> show.shape
(480, 640, 3)
>>> show.dtype
dtype('uint8')
>>> show.size
921600
I don't see any convert code about cv2.COLOR_BGR2RGB565, is there any other function to support RGB888 to RGB565?
Or someone knows how to convert ndarray RGB888 to RGB565?