opencv红外dat文件转为BMP并保存

整理一下opencv下将IR图像转为BMP的程序

#include<opencv2\opencv.hpp>

using namespace cv;
using namespace std;

//输入图像
String File_Path = "E:\\log\\ir_data_file_20190619_153236817.dat";

//图像保存位置
#define img_path  "E:\\处理\\"
#define img_type ".bmp"
#define IMG_WIDTH     640
#define IMG_HEIGHT    512
#define IMG_BITWIDTH  16384      //2^14 14位图像

unsigned short(imagedata[IMG_WIDTH*IMG_HEIGHT]);
unsigned short Hist[IMG_BITWIDTH];

//路径和文件数字
char *filename;
char  *number;

//两种不同的14位转8位映射
Mat  mat14to8(unsigned short *srcData);
Mat img14to8(ushort *in, int rows, int cols);

int main()
{
	Mat outputImage(IMG_HEIGHT, IMG_WIDTH, CV_8UC1, Scalar(0));


	//打开文件并确定结尾位置和图片数量
	FILE *pfile;
	if(pfile = fopen(File_Path.c_str(), "r")==NULL)
	{
		return false;
	}
	struct stat statbuf;
	stat(File_Path.c_str(), &statbuf);
	cout << "文件大小为" << statbuf.st_size << "B" << endl;
	int number_size = statbu
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值