lena.raw图片文件下载及打开方式

链接:lena.raw文件的百度网盘
https://pan.baidu.com/s/1C0HLhc81Y73mGnKrTG7qtQ
提取码:z2nw
打开方式:
1.使用Photoshop打开
注意:需要设置像素,如图
在这里插入图片描述
2.使用python打开
参考博客:https://blog.csdn.net/hahahahhahha/article/details/104304027
python代码:

import cv2  #OpenCV包
import numpy as np

# 首先确定原图片的基本信息:数据格式,行数列数,通道数
rows=512#图像的行数
cols=640#图像的列数
channels =1# 图像的通道数,灰度图为1

# 利用numpy的fromfile函数读取raw文件,并指定数据格式
img=np.fromfile(r'G:\BaiduNetdiskDownload\2.raw', dtype='uint8')
# 利用numpy中array的reshape函数将读取到的数据进行重新排列。
img=img.reshape(rows, cols, channels)

# 展示图像
cv2.imshow('Infared image-640*512-8bit',img)
# 如果是uint16的数据请先转成uint8。不然的话,显示会出现问题。
cv2.waitKey()
cv2.destroyAllWindows()
print('ok')


注意:
将路径修改为自己的文件路径
注意对应图片的行列数
需要使用cv2库和numpy库

图片:
lena512.raw

Guess you like

Origin blog.csdn.net/lic1697067085/article/details/116353553