简单记录一下python读取raw格式图像,因为reshape来来回回还交换轴搞得人头大,下次放在这里用来复制粘贴(3000热像仪)
提示:以下是本篇文章正文内容,下面案例可供参考
代码如下(示例):
import matplotlib.pyplot as plt
import numpy as np
def readRaw(path):#path为raw文件所在路径
type = 'uint16' #得到数据格式,如uint8和uint16等
imgData = np.fromfile(path, dtype=type)
#imgData = imgData.reshape(320, 240, -1,order = "F").swapaxes(0,1)
imgData = imgData.reshape(-1, 240, 320)
return imgData