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

📄 fmt_auto.cpp

📁 这是一个用c++编写的实现指纹识别的程序
💻 CPP
字号:
/*########################################################################  The contents of this file are subject to the Mozilla Public License  Version 1.0(the "License");   You  may  NOT  use this file except in  compliance with the License. You may obtain a copy of the License at                http:// www.mozilla.org/MPL/  Software distributed under the License is distributed on an "AS IS"  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See  the License for the specific language governing rights and limitations  under the License.  The Initial Developer of the Original Code is Shivang Patel.  Copyright(C) 2002. All Rights Reserved.  Authors: Shivang Patel           Jaap de Haan(jdh)    This file contains functions to read and write BMP files########################################################################*/#include "stdafx.h"#include "../ip-header/fmt_auto.h"typedef enum FvsImageFormat_t{    FvsImageUnknown,    FvsImageBitmap,    FvsImageGIF,    FvsImageJpeg,} FvsImageFormat_t;static FvsError_t FormatDetect(FvsFile_t in, /*@out@*/ FvsImageFormat_t* fmt);/* imports a fingeprint image from a jpeg file */FvsError_t AutoImport(FvsFile_t in, FvsImage_t image){    FvsError_t ret = FvsOK;    FvsImageFormat_t fmt;    ret = FormatDetect(in, &fmt);    if (ret==FvsOK)    {        ret = FileSeekToBegin(in);        switch (fmt)        {        case FvsImageJpeg:            ret = JpegImport(in, image);            break;        case FvsImageBitmap:            ret = BitmapImport(in, image);            break;        default:            ret = FvsBadFormat;        }    }    return ret;}static FvsError_t FormatDetect(FvsFile_t in, FvsImageFormat_t* fmt){    FvsError_t ret = FvsOK;    *fmt = FvsImageUnknown;    if (FileIsOpen(in)==FvsTrue)    {        ret = FileSeekToBegin(in);        if (ret==FvsOK)        {            FvsByte_t bytes[4];            if (FileRead(in, bytes, 4)==4)            {                switch(bytes[0])                {                case 'B':   // may be BM                    if (bytes[1]==(FvsByte_t)'M')                        *fmt = FvsImageBitmap;                    break;                case 'G':                    if (bytes[1]==(FvsByte_t)'I' && bytes[2]==(FvsByte_t)'F')                        *fmt = FvsImageGIF;                    break;                case 0xFF:                    if (bytes[1]==0xD8)                        *fmt = FvsImageJpeg;                    break;                }            }            else                ret = FvsIoError;        }    }    else        ret = FvsIoError;    return ret;}

⌨️ 快捷键说明

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