代码:
#include <iostream>
#include "ipp.h"
#include <stdio.h>
using namespace std;
#define width 512/* Image width */
#define height 512 /* Image height */
int main(void)
{
//fopen读取image
FILE *fpsrc = NULL; //读入文件指针
Ipp16u *src = new Ipp16u[width*height]; //读入
if ((fpsrc = fopen("src.raw", "rb")) == NULL)
{
printf("can not open the raw image");
return 0;
}
else
{
printf("IMAGE read OK\n");
}
fread(src, sizeof(Ipp16u), width*height, fpsrc);
fclose(fpsrc);
//fwrite写出数据
FILE *fpdst = NULL; //写出文件指针
Ipp16u *dst = new Ipp16u[width*height]; //写出
fpdst = fopen("dst.raw", "wb");
if (!fpdst)
{
return 1;
}
fwrite(dst, sizeof(Ipp16u), width * height, fpdst);
fclose(fpdst);
return 0;
}
第2篇 基于C/C++实现RAW格式图像读取和写出
最新推荐文章于 2024-05-12 11:22:19 发布