# -*- coding: utf-8 -*-
"""
Created on Thu Jan 10 10:48:00 2013
@author: Chen Ming
"""
from numpy import *
import Image
screenLevels = 255.0
def yuv_import(filename,dims,numfrm,startfrm):
fp=open(filename,'rb')
blk_size = prod(dims) *3/2
fp.seek(blk_size*startfrm,0)
Y=[]
U=[]
V=[]
print dims[0]
print dims[1]
d00=dims[0]//2
d01=dims[1]//2
Yt=zeros((dims[0],dims[1]),uint8,'C')
Ut=zeros((d00,d01),uint8,'C')
Vt=zeros((d00,d01),uint8,'C')
for i in range(numfrm):
for m in range(dims[0]):
for n in range(dims[1]):
#print m,n
Yt[m,n]=ord(fp.read(1))
for m in range(d00):
for n in range(d01):
Ut[m,n]=ord(fp.read(1))
for m in range(d00):
for
Python_yuv读取,yuv转rgb
最新推荐文章于 2022-07-02 23:55:41 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)