RAW12转RAW16
程序员文章站
2022-07-01 21:00:52
...
import bitstring
import numpy
with open(path, 'rb') as f:
data = f.read()
ii=numpy.zeros(int(2*len(data)/3))
ic = 0
for oo in range(0,int(len(data)/3)):
aa = bitstring.Bits(bytes=data[oo:oo+3], length=24)
ii[ic],ii[ic+1] = aa.unpack('uint:12,uint:12')
ic=ic+2
b = numpy.reshape(ii,(3840,2160))
上一篇: 读取16bit图片
下一篇: 使用ROS发布16bit原始图像