www.pudn.com > VC20070605zghLPR.rar > GlobalFunction.h
// GlobalFunction.h #include "Dibapi.h" #ifndef _INC_GlobalFunctionAPI #define _INC_GlobalFunctionAPI #includeusing namespace std; #define PI 3.1415926535 #define TRAINDATANUM 10 // 用于训练的数字样本的个数,应为10的整数倍 #define TRAINDATALET 26 // 用于训练的字母样本的个数,应为26的整数倍 //角度到弧度转化的宏 #define RADIAN(angle) ((angle)*PI/180.0) // 函数原型 BOOL WINAPI LinerTrans(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, FLOAT fA, FLOAT fB); BOOL WINAPI ThresholdTrans(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BYTE bThre); BOOL WINAPI WindowTrans(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BYTE bLow, BYTE bUp); BOOL WINAPI GrayStretch(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BYTE bX1, BYTE bY1, BYTE bX2, BYTE bY2); BOOL WINAPI InteEqualize(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); HGLOBAL WINAPI ZoomDIB(LPSTR lpbi, float fXZoomRatio, float fYZoomRatio); HGLOBAL WINAPI RotateDIB(LPSTR lpbi, int iRotateAngle); VOID WINAPI FFT(complex * TD, complex * FD, int r); BOOL WINAPI ErosionDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BOOL bHori , int structure[3][3]); BOOL WINAPI DilationDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BOOL bHori , int structure[3][3]); BOOL WINAPI OpenDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BOOL bHori , int structure[3][3]); BOOL WINAPI CloseDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BOOL bHori , int structure[3][3]); BOOL WINAPI ThiningDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI RobertDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI SobelDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI PrewittDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI KirschDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI GaussDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI DifferDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI PlateDIB1(LPSTR lpDIBBits, LONG lWidth, LONG lHeight,int* pPlateLine); BOOL WINAPI PlateDIB2(LPSTR lpDIBBits, LONG lWidth, LONG lHeight,int* pPlateLine); BOOL WINAPI Template(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, int iTempH, int iTempW, int iTempMX, int iTempMY, FLOAT * fpArray, FLOAT fCoef); BOOL WINAPI MedianFilter(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, int iFilterH, int iFilterW, int iFilterMX, int iFilterMY); unsigned char WINAPI GetMedianNum(unsigned char * bArray, int iFilterLen); BOOL WINAPI GradSharp(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BYTE bThre); int* RowscanDIB1(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); int* RowscanDIB2(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, int* pPlateLine); int* RowscanDIB3(LPSTR lpDIBBits, LPSTR lpOrgDIBBits, LONG lWidth, LONG lHeight,int* pPlateLine); int* RowscanDIB4(LPSTR lpDIBBits,LONG lWidth, LONG lHeight); BOOL WINAPI CharacterUnit(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI CharacterUnit1(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, int iWidth, int iHeight); BOOL WINAPI BPReco(); unsigned char WINAPI BPReco13Section(float* pRecoData); unsigned char WINAPI BPReco16SectionNumber(float* pRecoData); unsigned char WINAPI BPReco16SectionLetter(float* pRecoData); BOOL WINAPI BPRecoStruct(); BOOL WINAPI BPTrain(int iInputNum, int iMidNum, int iOutputNum); BOOL WINAPI BPTrain13Section(int iInputNum, int iMidNum, int iOutputNum); BOOL WINAPI BPTrain16SectionNumber(int iInputNum, int iMidNum, int iOutputNum); BOOL WINAPI BPTrain16SectionNumber2(int iInputNum, int iMidNum, int iOutputNum); BOOL WINAPI BPTrain16SectionLetter(int iInputNum, int iMidNum, int iOutputNum); BOOL WINAPI BPTrainStruct(int iInputNum, int iMidNum, int iOutputNum); BOOL WINAPI ContourDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI TraceDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); VOID WINAPI FFT(complex * TD, complex * FD, int r); VOID WINAPI IFFT(complex * FD, complex * TD, int r); VOID WINAPI DCT(double *f, double *F, int power); VOID WINAPI IDCT(double *F, double *f, int power); VOID WINAPI WALSH(double *f, double *F, int r); VOID WINAPI IWALSH(double *F, double *f, int r); BOOL WINAPI Fourier(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI DIBDct(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI DIBWalsh(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI DIBWalsh1(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI NUMBERSCANLINE(LPSTR lpDIBBits,LONG lWidth, LONG lHeight); BOOL WINAPI NUMBERSCANROW(LPSTR lpDIBBits,LONG lWidth, LONG lHeight); BOOL WINAPI ThresholdDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI AddMinusDIB (LPSTR lpDIBBits, LPSTR lpDIBBitsBK, LONG lWidth, LONG lHeight, bool bAddMinus); BOOL WINAPI HprojectDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI VprojectDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI TemplateMatchDIB (LPSTR lpDIBBits, LPSTR lpTemplateDIBBits, LONG lWidth, LONG lHeight,LONG lTemplateWidth,LONG lTemplateHeight); BOOL WINAPI HDifferProjDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI HDifferProjDIB2 (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI HDifferProjDIB3 (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); int* WINAPI HDifferProjDIB4 (LPSTR lpDIBBits, LONG lWidth, LONG lHeight); int WINAPI Distance13(LONG iWidth, LONG iHeight, int ix, int iy); int WINAPI Distance16(LONG iWidth, LONG iHeight, int ix, int iy); float* WINAPI CharExtract13Sect(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); float* WINAPI CharExtract16Sect(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); float* WINAPI CharExtract16Sect2(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); float* WINAPI CharExtractStruct(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); unsigned char WINAPI DistanceStruct(float* pCodeStruct); BOOL WINAPI HoughDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); BOOL WINAPI DIBToPCX256(LPSTR lpDIB, CFile& file); HDIB WINAPI ReadPCX256(CFile& file); #endif //!_INC_GlobalFunctionAPI typedef struct{ int Height; int Width; } Point; typedef struct{ int Value; int Dist; int AngleNumber; } MaxValue; // PCX文件头结构 typedef struct{ BYTE bManufacturer; BYTE bVersion; BYTE bEncoding; BYTE bBpp; WORD wLeft; WORD wTop; WORD wRight; WORD wBottom; WORD wXResolution; WORD wYResolution; BYTE bPalette[48]; BYTE bReserved; BYTE bPlanes; WORD wLineBytes; WORD wPaletteType; WORD wSrcWidth; WORD wSrcDepth; BYTE bFiller[54]; } PCXHEADER; // 函数原型 //BOOL WINAPI TranslationDIB1 (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, LONG lXOffset, LONG lYOffset); //BOOL WINAPI TranslationDIB (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, LONG lXOffset, LONG lYOffset); //BOOL WINAPI MirrorDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight, BOOL bDirection); //BOOL WINAPI TransposeDIB(LPSTR lpbi); //unsigned char WINAPI Interpolation (LPSTR lpDIBBits, LONG lWidth, LONG lHeight, FLOAT x, FLOAT y);