⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 import.c

📁 指纹识别C语言代码
💻 C
字号:
/*############################################################################# * 文件名:import.c * 功能:  一些基本的图像操作 * modified by  PRTsinghua@hotmail.com#############################################################################*/#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "import.h"
#include "floatfield.h"//#include <magick/api.h>/******************************************************************************  * 功能:从文件中加载指纹图像  * 参数:image       指纹图像  *       filename    文件名  * 返回:错误编号******************************************************************************/FvsImage_t my_FvsImageImport(int a)
{	FILE *fp;
	int i;
	unsigned char *data;
	unsigned int width=0,height=0;
	
	iFvsImage_t* p = NULL;

    p = (FvsImage_t)malloc(sizeof(iFvsImage_t));
    if (p!=NULL)
    {
        p->h        = 0;
        p->w        = 0;
        p->pitch    = 0;
        p->pimg     = NULL;
        p->flags    = FvsImageGray; /* 缺省的标记 */    
    }

////////////////////////reading////////////////////////////////////////////
    if((data=malloc(300*256*sizeof(unsigned char)))==NULL) printf("Error allocating");
	if(a==1) fp=fopen("finger1.bmp","rb");//
	if(a==2) fp=fopen("finger2.bmp","rb");//
	fseek(fp,18,0);
	fread(&width,2,1,fp);
	fseek(fp,2,1);
	fread(&height,2,1,fp);
    fseek(fp,1078,0);//1086
	
	fread(data,sizeof(unsigned char),256*300,fp);//read image.bmp data
	fclose(fp);
//////////////////////////////////////////////////////////////////
        p->h        = height;
        p->w        = width;
		p->pitch    = 256;
        p->pimg     = data;

		//for(i=0;i<1000;i++) printf("%x\n",p->pimg[i]);
	
		return (FvsImage_t)p;
		free(data);
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -