小编Gre*_*ale的帖子

在Python中将YUV转换为RGB,系数适用于Array,不适用于NumPy

以下代码获取原始 YUV 图像并使用数组操作将其转换为 RGB,并且需要很长时间。

from PIL import Image
from struct import *
import array
 
 
image_name = "frame2.raw" #Change to user input
width = int(3864) #Assumed to be static
height = int(2192) #Assumed to be static

y = array.array('B')  #B unsigned Char, I is unsigned int
u = array.array('B')  #The raw file is unsigned int 8
v = array.array('B')
 
f_y = open(image_name, "rb")
f_uv = open(image_name, "rb")
f_uv.seek(width*height, 1) #Change position of File handle seek(offset, from)
 
image_out = Image.new("RGB", (width, height)) …
Run Code Online (Sandbox Code Playgroud)

python rgb numpy image-processing yuv

5
推荐指数
1
解决办法
2543
查看次数

标签 统计

image-processing ×1

numpy ×1

python ×1

rgb ×1

yuv ×1