www.pudn.com > try2LPR-1.0.rar > LPRProcess.h


/* 
* Copyright (c) 2003, try2it.com 
* All rights reserved. 
* 
* This program is free software; you can redistribute it and/or modify it under 
* the terms of the GNU General Public License as published by the Free Software 
* Foundation; either version 2 of the License, or (at your option) any later 
* version. 
*  
* This program is distributed in the hope that it will be useful, but WITHOUT 
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 
* details. 
*  
* You should have received a copy of the GNU General Public License along with 
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
* Place - Suite 330, Boston, MA 02111-1307, USA. 
* 
* 文件名称:LPRProcess.h 
* 文件标识:LPR-02-06 
* 摘要:牌照识别的图像处理部分 
* 
* 当前版本:1.0 
* 作者:try2it.com 
* 开始日期:2003年09月28日 
* 完成日期:2003年09月30日 
*/ 
#ifndef _LPRPROCESS_H_ 
#define _LPRPROCESS_H_ 
 
// 定义变量 
#define PI  3.1415926536       
 
enum TPrjType 
{ 
	H_FILTER, 
	V_FILTER, 
	IH_FILTER, 
	IV_FILTER 
}; 
 
typedef struct tagTAngle 
{ 
	double HAngle; 
	double VAngle; 
}TAngle, *PAngle; 
 
#if (defined(__cplusplus) || defined(c_plusplus)) 
extern  "C" { 
#endif 
 
int InteEqualize(PGrayImg pDestImg, PGrayImg pSrcImg); 
 
int CalHistoGram(int HistoGram[], PGrayImg pSrcImg); 
 
int MedianFilter(PGrayImg pDestImg, PGrayImg pSrcImg, int iFilterH,  
				               int iFilterW, int iFilterMX, int iFilterMY); 
 
BYTE GetMedianNum(BYTE *aValue, int iLength); 
 
int GetLPPos(RECT *lpRect, PGrayImg pSrcImg); 
 
int GetLPYPos(int *pProject, int PrjLen, int *pStartYPos, int *pUpYPos, int *pDownYPos); 
 
int GetLPXPos(int *pProject, int PrjLen, int *pLeftXPos, int *pRightXPos); 
 
int Template(PGrayImg pDestImg, PGrayImg pSrcImg, int TemplateArr[], int TemplateN, double Coef); 
 
int ProjectImg(int *pProject, PGrayImg pSrcImg,  TPrjType PrjType); 
 
int ProjectFilter(int *pProject, int PrjLen, TPrjType PrjType, int LPAccurateHeight=40); 
 
int TwoPixelCarImg(PGrayImg pDestImg, PGrayImg pSrcImg, int Threshold); 
 
int GetSubImg(PGrayImg pDestImg, PGrayImg pSrcImg, RECT Rect); 
 
int GetSubColorImg(PColorImg pDestImg, PColorImg pSrcImg, RECT Rect); 
 
int RecoLPColor(TColorID *pLPColorID, PColorImg pSrcImg); 
 
int TwoPixelLPImg(PGrayImg pDestImg, PGrayImg pSrcImg,  
				    double MaxBlackRatio, double MinBlackRatio, int *pThreshold); 
 
int Invert(PGrayImg pDestImg, PGrayImg pSrcImg); 
 
int RectifyLP(PGrayImg pDestImg, PGrayImg pSrcImg, PGrayImg pModelImg); 
 
int Diff(PGrayImg pDestImg, PGrayImg pSrcImg, TPrjType PrjType); 
 
int HoughTrans(PAngle pAngle, PGrayImg pSrcImg, TPrjType PrjType); 
 
int GetLPAccuratePos(RECT *lpRect, PGrayImg pSrcImg); 
 
int GetLPAccurateXPos(int *pProject, int PrjLen, int LPHeight, int *pLeftXPos, int *pRightXPos); 
 
int GetLPAccurateYPos(int *pProject, int PrjLen, int *pUpYPos, int *pDownYPos); 
 
int GetLPCharPos(int *pCharCount, RECT LPCharRect[], PGrayImg pSrcImg); 
 
int OutLineProject(int *pProject, PGrayImg pSrcImg); 
 
int OutLineProjectFilter(int *pProject, int PrjLen, int LPHeight); 
 
int Merge2(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int Merge3(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int Merge4(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int Merge5(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int Merge6(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int Merge7(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int Merge8(int *pProject, int PrjLen, RECT LPCharRect[],  
		        int MergeID[], int StartID, int EndID, int CharHeight); 
 
int IsChar(int CharLeft, int CharRight, int CharHeight); 
 
 
int ReadParam(char *szFileName); 
 
 
int SaveParam(int LPHeight=80,         
			  int LPWidth=220,          
              int LPAccurateHeight=40,   
              int Threshold=160,        
			  int Threshold_HLP=100,    
              int LeftOffset=0,         
              int RightOffset=0,      
              int TopOffset=0,           
              int BottomOffset=0,     
			  char *szFileName="GDCLPR.ini"); 
 
RECT GetManualCutRect(int *pLeftOffset, int *pRightOffset, int *pTopOffset, int *pBottomOffset, int OriWidth, int OriHeight); 
 
 
#if (defined(__cplusplus) || defined(c_plusplus)) 
} 
#endif 
 
#endif /* _LPRHELPER_H_ */