?? import.c
字號(hào):
/*############################################################################# * 文件名:import.c * 功能: 一些基本的圖像操作 * modified by PRTsinghua@hotmail.com#############################################################################*/#include "import.h"#include <stdio.h>#include <magick/api.h>/****************************************************************************** * 功能:從文件中加載指紋圖像 * 參數(shù):image 指紋圖像 * filename 文件名 * 返回:錯(cuò)誤編號(hào)******************************************************************************/FvsError_t FvsImageImport(FvsImage_t image, const FvsString_t filename){ ExceptionInfo exception; Image* magicimage; ImageInfo* magicinfo; FvsError_t ret = FvsOK; FvsByte_t* buffer; FvsInt_t pitch; FvsInt_t height; FvsInt_t width; FvsInt_t i; /* 初始化 Magick 環(huán)境 */ InitializeMagick("."); GetExceptionInfo(&exception); /* 創(chuàng)建一個(gè)空的 imageinfo */ magicinfo = CloneImageInfo((ImageInfo*)NULL); /* 設(shè)置文件名 */ (void)strcpy(magicinfo->filename, filename); /* 讀圖像 */ magicimage = ReadImage(magicinfo, &exception); if (exception.severity!=UndefinedException) CatchException(&exception); if (magicimage!=(Image*)NULL) { ret = ImageSetSize(image, (FvsInt_t)magicimage->columns, (FvsInt_t)magicimage->rows); if (ret==FvsOK) { /* 獲得緩沖區(qū) */ buffer = ImageGetBuffer(image); pitch = ImageGetPitch(image); height = ImageGetHeight(image); width = ImageGetWidth(image); /* 歸一化 */ NormalizeImage(magicimage); /* 拷貝數(shù)據(jù) */ for (i=0; i<height; i++) { ExportImagePixels(magicimage, 0, i, width, 1, "I", CharPixel, buffer+i*pitch, &exception); } } DestroyImage(magicimage); } else ret = FvsFailure; /* 清理 */ DestroyImageInfo(magicinfo); DestroyExceptionInfo(&exception); DestroyMagick(); return ret;}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -