def load_uyvy(input_name, img_height, img_width):
with open(input_name, "rb") as src_file:
raw_data = np.fromfile(src_file, dtype=np.uint8, count=img_width*img_height*2)
im = raw_data.reshape(img_height, img_width, 2)
bgr = cv2.cvtColor(im, cv2.COLOR_YUV2BGR_UYVY)
print(type(bgr))
print(bgr.shape)
# print(bgr)
cv2.imwrite('./test.png', bgr)
应用下载网站:YUVEye官方下载-ZigZagSin
参考链接:为什么打开并查看一个YUV文件那么麻烦?-云社区-华为云
参考链接:YUV422 to RGB conversion using Python and OpenCV – Thinking Toasters