python3 raw 数据转换为jpg

python3 raw 数据转换为jpg,第1张

python3 raw 数据转换为jpg python3 raw 数据转换为jpg

我们大家都知道,sensor 直接出来的裸数据为raw 数据,没有经过编解码,压缩。




我们需要将raw数据转换为其他格式比如jpg,png,bmp 人眼才能看到。


好了,废话不多说,直接上代码。


import numpy as np
import imageio
rawfile = np.fromfile('C:/Users/awssome/Desktop/3.raw', dtype='uint16') # 以int16读图
print(rawfile.shape)
rawfile.shape = (1520, 2688)
print(rawfile.shape)
b=rawfile.astype('uint16')#变量类型转换
print(b.dtype)
imageio.imwrite("C:/Users/awsome/Desktop/3.jpg", b) import matplotlib.pyplot as pyplot
pyplot.imshow(rawfile)
pyplot.show()

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/588195.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存