当前位置: 首页>>代码示例>>C++>>正文


C++ Valid函数代码示例

本文整理汇总了C++中Valid函数的典型用法代码示例。如果您正苦于以下问题:C++ Valid函数的具体用法?C++ Valid怎么用?C++ Valid使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Valid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AlignMeanShapeToBothEyesNoMouth

static Shape AlignMeanShapeToBothEyesNoMouth(
    const DetPar& detpar,                      // in
    const Shape&  meanshape)                   // in
{
    if (trace_g)
        lprintf("AlignToBothEyesNoMouth           ");

    CV_Assert(NSIZE(meanshape) > 0 && PointUsed(meanshape, 0));
    CV_Assert(Valid(detpar.lex));
    CV_Assert(Valid(detpar.rex));

    Shape meanline(2, 2), detline(2, 2);       // line from eye to eye

    meanline(0, IX) = meanshape(L_LPupil, IX); // left eye
    meanline(0, IY) = meanshape(L_LPupil, IY);
    meanline(1, IX) = meanshape(L_RPupil, IX); // right eye
    meanline(1, IY) = meanshape(L_RPupil, IY);

    detline(0, IX) = detpar.lex;               // left eye
    detline(0, IY) = detpar.ley;
    detline(1, IX) = detpar.rex;               // right eye
    detline(1, IY) = detpar.rey;

    return AlignShape(meanshape, AlignmentMat(meanline, detline));
}
开发者ID:13221325403,项目名称:openbr,代码行数:25,代码来源:startshape.cpp

示例2: TraceEyesMouth

static void TraceEyesMouth(
    Image&  face_roi,           // out: ROI around face, possibly rotated upright
    DetPar& detpar_roi)         // out: detpar wrt to face_roi
{
#if TRACE_IMAGES // will be 0 unless debugging (defined in stasm.h)

    CImage cimg; cvtColor(face_roi, cimg, CV_GRAY2BGR); // color image
    rectangle(cimg,
              cv::Point(cvRound(detpar_roi.x - .5 * detpar_roi.width),
                        cvRound(detpar_roi.y - .5 * detpar_roi.height)),
              cv::Point(cvRound(detpar_roi.x + .5 * detpar_roi.width),
                        cvRound(detpar_roi.y + .5 * detpar_roi.height)),
              ToCvColor(C_BLUE), 3);
    if (Valid(detpar_roi.lex))
        cv::circle(cimg,
                   cv::Point(cvRound(detpar_roi.lex), cvRound(detpar_roi.ley)),
                   MAX(2, face_roi.cols / 40),
                   cv::Scalar(0, 0, 255), 2);
    if (Valid(detpar_roi.rex))
        cv::circle(cimg,
                   cv::Point(cvRound(detpar_roi.rex), cvRound(detpar_roi.rey)),
                   MAX(2, face_roi.cols / 40),
                   cv::Scalar(0, 0, 255), 2);
    if (Valid(detpar_roi.mouthx))
        cv::circle(cimg,
                   cv::Point(cvRound(detpar_roi.mouthx), cvRound(detpar_roi.mouthy)),
                   MAX(2, face_roi.cols / 40),
                   cv::Scalar(0, 0, 255), 2);
    char s[SLEN]; sprintf(s, "%s_25_eyemouth.bmp", Base(imgpath_g));
    lprintf("%s\n", s);
    if (!cv::imwrite(s, cimg))
        Err("Cannot write %s", s);

#endif
}
开发者ID:TaiManProject,项目名称:Dirks_Code_V3,代码行数:35,代码来源:startshape.cpp

示例3: AlignMeanShapeToRightEyeAndMouth

static Shape AlignMeanShapeToRightEyeAndMouth(
    const DetPar& detpar,                             // in
    const Shape&  meanshape)                          // in
{
    if (trace_g)
        lprintf("AlignToRightEyeAndMouth          ");

    CV_Assert(NSIZE(meanshape) > 0 && PointUsed(meanshape, 0));
    CV_Assert(!Valid(detpar.lex));   // left eye invalid? (else why are we here?)
    CV_Assert(Valid(detpar.rex));    // right eye valid?
    CV_Assert(Valid(detpar.mouthx)); // mouth valid?

    const double x_meanmouth =
       (meanshape(L_CTopOfTopLip, IX) + meanshape(L_CBotOfBotLip, IX)) / 2;

    const double y_meanmouth =
       (meanshape(L_CTopOfTopLip, IY) + meanshape(L_CBotOfBotLip, IY)) / 2;

    Shape meanline(2, 2), detline(2, 2);              // line from eye to mouth

    meanline(0, IX) = meanshape(L_RPupil, IX);        // right eye
    meanline(0, IY) = meanshape(L_RPupil, IY);
    meanline(1, IX) = x_meanmouth;                    // mouth
    meanline(1, IY) = y_meanmouth;

    detline(0, IX) = detpar.rex;                      // right eye
    detline(0, IY) = detpar.rey;
    detline(1, IX) = detpar.mouthx;                   // mouth
    detline(1, IY) = detpar.mouthy;

    return AlignShape(meanshape, AlignmentMat(meanline, detline));
}
开发者ID:13221325403,项目名称:openbr,代码行数:32,代码来源:startshape.cpp

示例4: EstartEyes

static Shape EstartEyes(
    const DetPar& detpar_roi,      // in: detpar wrt the ROI
    const Image&  face_roi,        // in
    const Shape&  meanshape)       // in
{
    Shape startshape;
    Shape meanshape1(meanshape);
    if (Valid(detpar_roi.lex) && Valid(detpar_roi.rex)) // both eyes available?
    {
        FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
        // TODO Tune the following code, what approach is best?
        if (detpar_roi.eyaw == EYAW00)
            startshape = AlignMeanShapeToBothEyesEstMouth(detpar_roi, meanshape1);
        else
            startshape = AlignMeanShapeToBothEyesNoMouth(detpar_roi, meanshape1);
        FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
    }
    else // at least one eye is missing, use the face det rectangle
    {
        startshape =
            AlignMeanShapeToFaceDet(detpar_roi, meanshape1,
                                        FACERECT_SCALE_WHEN_NO_EYES, face_roi);
    }
    return startshape;
}
开发者ID:TaiManProject,项目名称:Dirks_Code_V3,代码行数:25,代码来源:startshape.cpp

示例5: AlignMeanShapeToBothEyesEstMouth

static Shape AlignMeanShapeToBothEyesEstMouth(
    const DetPar& detpar,                      // in
    const Shape&  meanshape)                   // in
{
    // .48 was tested to give slightly better worse case results than .50
    static double EYEMOUTH_TO_FACERECT_RATIO = .48;

    if (trace_g)
        lprintf("AlignToBothEyesNoMouth(EstMouth) ");

    CV_Assert(NSIZE(meanshape) > 0 && PointUsed(meanshape, 0));
    CV_Assert(Valid(detpar.lex));
    CV_Assert(Valid(detpar.rex));

    // estimate the mouth's position

    double x_eyemid = 0;
    switch (detpar.eyaw)
    {
        case EYAW00:                                 //  mid point
            x_eyemid = .50 * detpar.lex + .50 * detpar.rex;
            break;
        // TODO The constants below have not been empirically optimized.
        case EYAW_45:                                // closer to left eye
            x_eyemid = .30 * detpar.lex + .70 * detpar.rex;
            break;
        case EYAW_22:                                // closer to left eye
            x_eyemid = .30 * detpar.lex + .70 * detpar.rex;
            break;
        case EYAW22:                                 // closer to right eye
            x_eyemid = .30 * detpar.lex + .70 * detpar.rex;
            break;
        case EYAW45:                                 // closer to right eye
            x_eyemid = .30 * detpar.lex + .70 * detpar.rex;
            break;
        default:
            Err("AlignMeanShapeToBothEyesEstMouth: Invalid eyaw %d", detpar.eyaw);
            break;
    }
    const double y_eyemid = (detpar.ley + detpar.rey) / 2;

    Shape mean_tri(3, 2), det_tri(3, 2);             // triangle of eyes and mouth

    mean_tri(0, IX) = meanshape(L_LPupil, IX);       // left eye
    mean_tri(0, IY) = meanshape(L_LPupil, IY);
    mean_tri(1, IX) = meanshape(L_RPupil, IX);       // right eye
    mean_tri(1, IY) = meanshape(L_RPupil, IY);
    mean_tri(2, IX) = meanshape(L_CBotOfBotLip, IX); // mouth
    mean_tri(2, IY) = meanshape(L_CBotOfBotLip, IY);

    det_tri(0, IX) = detpar.lex;                     // left eye
    det_tri(0, IY) = detpar.ley;
    det_tri(1, IX) = detpar.rex;                     // right eye
    det_tri(1, IY) = detpar.rey;
    det_tri(2, IX) = x_eyemid;                       // mouth
    det_tri(2, IY) = y_eyemid + EYEMOUTH_TO_FACERECT_RATIO * detpar.width;

    return AlignShape(meanshape, AlignmentMat(mean_tri, det_tri));
}
开发者ID:13221325403,项目名称:openbr,代码行数:59,代码来源:startshape.cpp

示例6: if

flag PE_VolFlow::ValidateData(ValidateDataBlk & VDB)
  {
  if (Valid(OpVol))
    OpNVol=dNAN;
  else if (!Valid(OpNVol))
    OpNVol=10.0;
  return True;
  }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:8,代码来源:PPENEQNS.CPP

示例7: DoRunning

void PL_SoftStSp::EvalCtrlActions(FlwNode* pFNode)
  {
  DoRunning();

  double dReqdSpd, dDiffSpd;

  switch (iFwdRev)
    {
    case PLSS_FwdOnly:
      m_dSpeedReqd=Range(0.0, m_dSpeedReqd, 1.0);
      dReqdSpd=m_dSpeedReqd;
      if (Valid(m_dManualSpeed))
        m_dManualSpeed=Range(0.0, m_dManualSpeed, 1.0);
      break;
    case PLSS_FwdRevLogic:
      m_dSpeedReqd=Range(0.0, m_dSpeedReqd, 1.0);
      dReqdSpd=m_dSpeedReqd*(bRunRev ? -1 : 1);
      if (Valid(m_dManualSpeed))
        m_dManualSpeed=Range(0.0, m_dManualSpeed, 1.0);
      break;
    case PLSS_FwdRevRegulation:
      m_dSpeedReqd=Range(-1.0, m_dSpeedReqd, 1.0);
      dReqdSpd=m_dSpeedReqd;
      if (Valid(m_dManualSpeed))
        m_dManualSpeed=Range(-1.0, m_dManualSpeed, 1.0);
      break;
    }
  // Decide the required position
  if (!bRunning)
    dReqdSpd=0.0;
      
  // the difference
  dDiffSpd = dReqdSpd-m_dSpeed;
  // limit the diff by the stroketime
  if (fabs(m_dSpeed+dDiffSpd*0.01)>fabs(m_dSpeed))
    dDiffSpd = Sign(dDiffSpd)*Min(fabs(dDiffSpd), ICGetTimeInc()/GTZ(dStartTime));
  else
    dDiffSpd = -Sign(dDiffSpd)*Max(-fabs(dDiffSpd),-ICGetTimeInc()/GTZ(dStopTime));

  // apply it;
  m_dSpeed+=dDiffSpd;

  m_dSpeed=Range(-1.0, m_dSpeed, 1.0);
  if (!bRunning)
    m_dMapSpeed=0.0;
  else 
    {
    if (Valid(m_dManualSpeed))
      m_dMapSpeed=m_dManualSpeed;
    else
      m_dMapSpeed=m_dSpeed;
    m_dMapSpeed=dMapLo+m_dMapSpeed*(dMapHi-dMapLo);
    }
  
  };
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:55,代码来源:MTRLOGIC.CPP

示例8: EstRotFromEyeAngle

static double EstRotFromEyeAngle( // estimate face rotation from intereye angle
    const DetPar& detpar)         // in: detpar wrt the ROI
{
    double rot = 0;

    if (Valid(detpar.lex) && Valid(detpar.rey)) // both eyes detected?
        rot = RadsToDegrees(-atan2(detpar.rey - detpar.ley,
                                   detpar.rex - detpar.lex));

    return rot;
}
开发者ID:13221325403,项目名称:openbr,代码行数:11,代码来源:startshape.cpp

示例9: EyeAngle

double EyeAngle(          // eye angle in degrees, INVALID if eye angle not available
    const DetPar& detpar) // in: detpar wrt the ROI
{
    double angle = 0;
    if (Valid(detpar.lex) && Valid(detpar.rey)) // both eyes detected?
    {
        angle = RadsToDegrees(
                    -atan2(detpar.rey - detpar.ley,
                           detpar.rex - detpar.lex));
    }
    return angle;
}
开发者ID:TaiManProject,项目名称:Dirks_Code_V3,代码行数:12,代码来源:startshape.cpp

示例10: Valid

void BoxWorldState::Update(void) {
	if(gameController->GetInput() == "B" || gameController->GetInput() == "b") {
		Valid();
        GoToMenu();
    }
	else if(gameController->GetInput() == "H" || gameController->GetInput() == "h") {
		Valid();
        GoToHighScore();
    }
	else
		NotValid();
}
开发者ID:fantanoice,项目名称:Games-Programming,代码行数:12,代码来源:BoxWorldState.cpp

示例11: isOlder

int isOlder(char *dob1, char *dob2)
{
	int day1 = 0, day2 = 0, mnth1 = 0, mnth2 = 0, yr1 = 0, yr2 = 0;
	int i;
	for (i = 0; i < 2; i++)
	{
		if (dob1[i]<48 || dob1[i]>57 || dob2[i]<48 || dob2[i]>57)
			return -1;
		day1 = (day1 * 10) + (dob1[i] - '0');
		day2 = (day2 * 10) + (dob2[i] - '0');
	}
	for (i = 3; i < 5; i++)
	{
		if (dob1[i]<48 || dob1[i]>57 || dob2[i]<48 || dob2[i]>57)
			return -1;
		mnth1 = (mnth1 * 10) + (dob1[i] - '0');
		mnth2 = (mnth2 * 10) + (dob2[i] - '0');
	}
	for (i = 6; i < 10; i++)
	{
		if (dob1[i]<48 || dob1[i]>57 || dob2[i]<48 || dob2[i]>57)
			return -1;
		yr1 = (yr1 * 10) + (dob1[i] - '0');
		yr2 = (yr2 * 10) + (dob2[i] - '0');
	}
	if (Valid(day1, mnth1, yr1) && Valid(day2, mnth2, yr2))
	{
		if (yr1 < yr2)
			return 1;
		else if (yr2 < yr1)
			return 2;
		else
		{
			if (mnth1 < mnth2)
				return 1;
			else if (mnth2 < mnth1)
				return 2;
			else
			{
				if (day1 < day2)
					return 1;
				else if (day2 < day1)
					return 2;
				else
					return 0;
			}
		}
	}
	else
		return -1;


}
开发者ID:MakarandNsd,项目名称:MissionRnD-C-Basics,代码行数:53,代码来源:isOlder.cpp

示例12: StartShapeFromDetPar

static Shape StartShapeFromDetPar(
    const DetPar& detpar_roi,      // in: detpar wrt the ROI
    const Image&  face_roi,        // in
    const Shape&  meanshape,       // in
    ESTART        estart)          // in: use mouth etc. to posn start shape?
{
    CV_Assert(estart == ESTART_RECT_ONLY ||
              estart == ESTART_EYES ||
              estart == ESTART_EYE_AND_MOUTH);

    Shape startshape;
    Shape meanshape1(meanshape);

    if (estart == ESTART_EYE_AND_MOUTH &&             // use both eyes and mouth?
        Valid(detpar_roi.mouthx) &&
        Valid(detpar_roi.lex) &&
        Valid(detpar_roi.rex))
    {
        FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
        startshape = AlignMeanShapeToBothEyesAndMouth(detpar_roi, meanshape1);
        FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
    }
    else if (Valid(detpar_roi.lex) &&                 // use both eyes?
             Valid(detpar_roi.rex))
    {
        FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
        // TODO Tune the following code, what approach is best?
        if (detpar_roi.eyaw == EYAW00)
            startshape = AlignMeanShapeToBothEyesEstMouth(detpar_roi, meanshape1);
        else
            startshape = AlignMeanShapeToBothEyesNoMouth(detpar_roi, meanshape1);
        FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
    }
    else if (estart == ESTART_EYE_AND_MOUTH &&        // use left eye and mouth?
             Valid(detpar_roi.mouthx) &&
             Valid(detpar_roi.lex))
    {
        FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
        startshape = AlignMeanShapeToLeftEyeAndMouth(detpar_roi, meanshape1);
        FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
    }
    else if (estart == ESTART_EYE_AND_MOUTH &&        // use right eye and mouth?
             Valid(detpar_roi.mouthx) &&
             Valid(detpar_roi.rex))
    {
        FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
        startshape = AlignMeanShapeToRightEyeAndMouth(detpar_roi, meanshape1);
        FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
    }
    else // last resort: use the face det rectangle (can't use facial features)
    {
        startshape =
            AlignMeanShapeToFaceDetRect(detpar_roi, meanshape1,
                                        FACERECT_SCALE_WHEN_NO_EYES, face_roi);
    }
    return JitterPointsAt00(startshape);
}
开发者ID:13221325403,项目名称:openbr,代码行数:57,代码来源:startshape.cpp

示例13: pawnAtk

uint64_t pawnAtk(int sq, int color)
{
	uint64_t ret = 0;
	int x = GetX(sq);
	int y = GetY(sq);
	
	if (color == 0)
	{
		if (Valid(x+1) && Valid(y+1))
		{
			ret |= Bit(Sq(x+1, y+1));
		}
		
		if (Valid(x-1) && Valid(y+1))
		{
			ret |= Bit(Sq(x-1, y+1));
		}
	}
	else
	{
		if (Valid(x+1) && Valid(y-1))
		{
			ret |= Bit(Sq(x+1, y-1));
		}
		
		if (Valid(x-1) && Valid(y-1))
		{
			ret |= Bit(Sq(x-1, y-1));
		}
	}
	
	return ret;
}
开发者ID:enlighter,项目名称:giraffe,代码行数:33,代码来源:gen_bitboard_consts.cpp

示例14: EvaluateFlwEqn

flag PE_VolFlow::EvaluateFlwEqn(eScdFlwEqnTasks Task, CSpPropInfo *pProps, CFlwBlkBase & FE, bool On, double Regulation, CFBPhysData *pPhD0, CFBPhysData *pPhD1)
  {
  double dPq1, dPq2;
  if (Valid(OpVol))
    {
    double Rho=Max(0.1, FE.MeanRho(pProps));
    double K=fabs(OpDP)/Pow(fabs(OpVol), PwrLaw);
    double Vol1 = FE.SetQvMeasRange(Rho, 1.0);
    double dQm  = FE.DQmMeas(1.001);
    double Vol2 = FE.QvMeas(1.001);

    dPq1 = -FE.QmSign()*K*Pow(Vol1,PwrLaw);
    dPq2 = -FE.QmSign()*K*Pow(Vol2,PwrLaw);
    FE.SetDPq(dPq1, (dPq2 - dPq1)/dQm);
    }
  else
    {
    double NRho=Max(0.1, FE.MeanRho(pProps)*Norm_P/GTZ(FE.MeanPress())*FE.MeanTemp(pProps)/Norm_T);
    double K=fabs(OpDP)/Pow(fabs(OpNVol), PwrLaw);
    double NVol1 = FE.SetQvMeasRange(NRho, 1.0);
    double dQm  = FE.DQmMeas(1.001);
    double NVol2 = FE.QvMeas(1.001);

    dPq1 = -FE.QmSign()*K*Pow(NVol1,PwrLaw);
    dPq2 = -FE.QmSign()*K*Pow(NVol2,PwrLaw);
    FE.SetDPq(dPq1, (dPq2 - dPq1)/dQm);
    }

  m_dDP=fabs(dPq1);
  FE.SetFunctOfPress();

  return True;
  };
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:33,代码来源:PPENEQNS.CPP

示例15: string_check

int string_check(const char *p,int len) {
	char buf[255];
	memset(buf,0,255);
	memcpy(buf,p,len);
	//printf("string_check: %s\n",buf);
	return Valid(buf,mask2);
}
开发者ID:benedicktj,项目名称:mYnexia,代码行数:7,代码来源:login.c


注:本文中的Valid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。