protected isFaceBoxInsideFaceArea()

in source/client/src/liveness/nose/States.ts [32:42]


  protected isFaceBoxInsideFaceArea(faceBox: faceapi.Box, addTolerance = true) {
    const tolerance: number = addTolerance ? parseInt(ConfigUtils.getConfig().FACE_AREA_TOLERANCE_PERCENT) / 100 : 0;
    return (
      faceBox.x >= this.noseChallengeParams.areaLeft * (1 - tolerance) &&
      faceBox.y >= this.noseChallengeParams.areaTop * (1 - tolerance) &&
      faceBox.x + faceBox.width <=
        this.noseChallengeParams.areaLeft + this.noseChallengeParams.areaWidth * (1 + tolerance) &&
      faceBox.y + faceBox.height <=
        this.noseChallengeParams.areaTop + this.noseChallengeParams.areaHeight * (1 + tolerance)
    );
  }