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

📄 masmconf.cpp

📁 这是个人脸识别程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
#define P_Mask000_CircleSigmAbsSum		(PROF_WindowCircle|PROF_SigmAbsSum|PROF_FBit|PROF_Mask000)#define P_Mask202_CircleSigmAbsSum		(PROF_WindowCircle|PROF_SigmAbsSum|PROF_FBit|PROF_Mask202)#define P_Mask011_CircleSigmAbsSum		(PROF_WindowCircle|PROF_SigmAbsSum|PROF_FBit|PROF_Mask011)#define P_Mask010_CircleSigmAbsSum		(PROF_WindowCircle|PROF_SigmAbsSum|PROF_FBit|PROF_Mask010)#define P_GradMagBR_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_GradMagBelowRight)#define P_Edge_CircleFlat			(PROF_WindowCircle|PROF_Flat|PROF_Edgeness)#define P_Corn_CircleFlat			(PROF_WindowCircle|PROF_Flat|PROF_Cornerness)#define P_GradBR_CircleFlat			(PROF_WindowCircle|PROF_Flat|PROF_GradBelowRight)#define P_Harris_CircleFlat			(PROF_WindowCircle|PROF_Flat|PROF_HarrisStephens)#define P_MaskGray_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_MaskGray)#define P_Mask021_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask021)#define P_Mask141_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask141)#define P_Mask181_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask181)#define P_Mask000_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask000)#define P_Mask202_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask202)#define P_Mask011_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask011)#define P_Mask010_CircleFlat		(PROF_WindowCircle|PROF_Flat|PROF_FBit|PROF_Mask010)#endif CONF_fGen2dProfs//-----------------------------------------------------------------------------// This specifies the profile type to use when generating the model.//// This function is used during training and not during search//// Following apply when GENERATING profile data (that's why there's a "Gen" in the function name).// When USING profile data from the model file (i.e during search) we// use the profile type specified in the model file.unsigned GetGenProfSpec (int iLev, int iPoint){#if CONF_fGen2dProfs#if CONF_fDebug2dProfs	if ((iLev == 0) && (iPoint == 7))		// for debugging using m000_11t.bmp and m128_12t.bmp#else	if (CONF_Gen2dProf)#endif		{		unsigned Prof0 = P_GradBR_EqSigmAbsSum;		unsigned Prof1 = 0;		unsigned Prof2 = 0;		DASSERT((Prof0 & ~0xff0000ff) == 0);		DASSERT((Prof1 & ~0xff0000ff) == 0);		DASSERT((Prof2 & ~0xff0000ff) == 0);		return PROF_2d | (Prof2 << 16) | (Prof1 << 8) | Prof0;		}#endif // CONF_fGen2dProfsSigmoidScaleGlobal = 1000;	// in my master's thesis: ShapeA=100.0 ShapeB=1000.0return PROF_Grad|PROF_Flat;	// classic Cootes 1-dimensional profile}//-----------------------------------------------------------------------------// This initializes ASMs for search by reading the ASMs from ASM files on disk// It also sets parameters of the models not specified in the ASM files//// This function is used during search and not during training//// On entry Asm[0..nModels].sFile must be initialized// On exit, all fields of Asm[0..nModels] is initializedvoid InitAsmsForSearch (tAsmModel Model[], 					// out, except sFile is in						int nModels, unsigned ImageBits)	// in{for (int iModel = 0; iModel < nModels; iModel++)	{	int nWantedLandmarks = 0;		// 0 means any nbr of landmarks in ASM file is ok	tAsmModel *pModel = &Model[iModel];	if (pModel->sFile[0] == 0)		Err("You must specify %d models with the -m flag", nModels);	pModel->iModel = iModel;	switch (iModel)		{		case 0:			{			eStartMethod StartMethod = SM_UseNnFaceAndEyesRealignEyes;			if (CONF_fDebug1dProfs)				StartMethod = SM_UseRefShapeAndAlignedMeanShape;			else if (CONF_fDebug2dProfs)				StartMethod = SM_UseRefShape;			InitAsm(*pModel, pModel->sFile,		// get ASM model from file				CONF_fFancyShapeModel,				CONF_nShapeModelIters,				StartMethod);			break;			}		case 1:			ASSERT(!(ImageBits & IM_DoubleScale)); //TODO notify user of bug: if double scale used, 2nd model search is wrong			InitAsm(*pModel, pModel->sFile,				CONF_fFancyShapeModel,				CONF_nShapeModelIters,				SM_UsePrevModelResult);			pModel->nStartLev = 1;	// override file nStartLev: set to 1 which gives almost as good results and									// is faster than searching all levels			break;		default:			Warn("More than two models");		//TODO I've never done any testing with more than two models			InitAsm(*pModel, pModel->sFile,				CONF_fFancyShapeModel,				CONF_nShapeModelIters,				SM_UsePrevModelResult);			pModel->nStartLev = 0;	// override file nStartLev			break;		}	if (nWantedLandmarks && pModel->nPoints != nWantedLandmarks)		Err("%s doesn't specify %d landmarks", pModel->sFile, nWantedLandmarks);	if (pModel->StartMethod == SM_UseRefShape && pModel->fExplicitPrevNext)		{		// see SysErr in startshape.cpp:GetStartShapeFromGlobalDet TODO		Warn("Forcing ExplicitPrevNext to false (overrides model setting fgExplicitPrevNext=1)");		pModel->fExplicitPrevNext = false;		}	}}//-----------------------------------------------------------------------------// Accumulate the results of the current search (in Shape) into the// combined results for all searches (in CombinedShape)//// This function is used during search and not during trainingvoid CombineModelSearchResults (SHAPE &CombinedShape,		// io: best shape formed by combining all searches					int iModel, const SHAPE &Shape)			// in: results of current search{switch (iModel)	{	case 0:		CombinedShape = Shape;		break;	case 1:		{		int nPoints = CombinedShape.nrows();		ASSERT(Shape.nrows() >= nPoints);		for (int iPoint = 0; iPoint < nPoints; iPoint++)			{#if 1			if (1)														// use all points#else			if (iPoint < MLMouthCorner || iPoint > MMouthBotOfTopLip)	// replace all except mouth#endif				{				CombinedShape(iPoint, VX) = Shape(iPoint, VX);				CombinedShape(iPoint, VY) = Shape(iPoint, VY);				}			}		break;		}	default:		SysErr("CombineModelSearchResults");	}}

⌨️ 快捷键说明

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