📄 export.c
字号:
/*#############################################################################
* 文件名:export.c
* 功能: 指纹图像输出保存
* modified by PRTsinghua@hotmail.com
#############################################################################*/
#include "import.h"
#include <stdio.h>
/******************************************************************************
* 功能:将一个指纹图像输出到一个文件,文件的格式由文件的扩展名决定
* 参数:filename 将要保存图像的文件名
* image 将要导出的图像
* 返回:错误代码
******************************************************************************/
FvsError_t FvsImageExport(const FvsImage_t image, const FvsString_t filename,
FvsByte_t bmfh[14],BITMAPINFOHEADER *bmih,RGBQUAD *rgbq)
{
FvsError_t ret = FvsOK;
FvsByte_t* buffer;
FvsInt_t pitch;
FvsInt_t height;
FvsInt_t width;
FvsInt_t i;
FvsFile_t file;
file = FileCreate();
if(FileOpen(file,filename,FvsFileWrite|FvsFileCreate)==FvsFailure)
{
ret = FvsFailure;
}
if(FileWrite(file,bmfh,14)!=14)
ret = FvsFailure;
if(FileWrite(file,bmih,sizeof(BITMAPINFOHEADER))!=sizeof(BITMAPINFOHEADER))
ret = FvsFailure;
if(FileWrite(file,rgbq,sizeof(RGBQUAD)*256)!=sizeof(RGBQUAD)*256)
ret = FvsFailure;
if(ret==FvsFailure)
{
printf("Write file error");
return ret;
}
else
{
/* 获得缓冲区 */
buffer = ImageGetBuffer(image);
pitch = ImageGetPitch(image);
height = ImageGetHeight(image);
width = ImageGetWidth(image);
/* 拷贝数据 */
for (i=height-1; i>=0; i--)
{
FileWrite(file,buffer+i*pitch,WIDTHBYTES(pitch*8));
}
}
FileDestroy(file);
return ret;
}
/*#if 0
/* The WAND interface is pretty buggy... use the old API */
/******************************************************************************
* 功能:将一个指纹图像输出到一个文件,文件的格式由文件的扩展名决定
* 参数:filename 将要保存图像的文件名
* image 将要导出的图像
* 返回:错误代码
******************************************************************************/
/*FvsError_t FvsImageExport(const FvsImage_t image, const FvsString_t filename)
{
MagickWand* wand;
FvsByte_t* buffer;
FvsByte_t* out;
FvsInt_t pitch;
FvsInt_t height;
FvsInt_t width;
FvsError_t ret = FvsOK;
FvsInt_t i;
/* 初始化Magick */
/* wand = NewMagickWand();
if (wand!=NULL)
{
/* 提取参数 */
/* buffer = ImageGetBuffer(image);
width = ImageGetWidth(image);
height = ImageGetHeight(image);
pitch = ImageGetPitch(image);
/* 为像素申请新的内存 */
/* out = (FvsByte_t*)malloc(width*height);
if (out!=NULL)
{
for (i=0; i<height; i++)
memcpy(out+i*width, buffer+i*pitch, width);
/* 输出的图像数据现在在连续的缓冲区中 */
/* MagickSetSize(wand, width, height);
MagickSetImagePixels(wand, 0, 0, width, height, "I", CharPixel, out);
/* 写数据 */
/* MagickWriteImage(wand, filename);
free(out);
}
else
ret = FvsMemory;
/* 清理 */
/* DestroyMagickWand(wand);
}
else
ret = FvsMemory;
return ret;
}
#endif */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -