Python知识点:示例1:展示YUV420SP数据(Python版本)
发布时间
阅读量:
阅读量

import cv2
import numpy as np
import argparse
class ShowYUV:
def __init__(self, filename, size):
self.height, self.width = size
self.frame_len = int(self.width * self.height * 3 / 2)
self.f = open(filename, 'rb')
self.shape = (int(self.height*1.5), self.width)
def read_raw(self):
try:
raw = self.f.read(self.frame_len)
yuv = np.frombuffer(raw, dtype=np.uint8)
全部评论 (0)
还没有任何评论哟~
