Пример #1
0
 /// <summary>
 /// それぞれの顔パーツ情報を初期状態に戻します。
 /// </summary>
 /// <param name="calibration"></param>
 /// <param name="lerpFactor">0-1の範囲で指定される、基準位置に戻すのに使うLerpファクタ</param>
 public void LerpToDefault(CalibrationData calibration, float lerpFactor)
 {
     Outline.LerpToDefault(calibration, lerpFactor);
     for (int i = 0; i < PartsWithoutOutline.Length; i++)
     {
         PartsWithoutOutline[i].LerpToDefault(calibration, lerpFactor);
     }
 }
Пример #2
0
        public void LerpToDefault(CalibrationData calibration, float lerpFactor)
        {
            var factor = 1.0f - lerpFactor;

            //NOTE: Yaw, Rollは(ホントは良くないんだけど)そもそもキャリブが入ってないので、これで正しい
            FacePitchRate = Mathf.Lerp(FacePitchRate, calibration.pitchRateOffset, lerpFactor);
            _faceYawRate *= factor;
            _faceRollRad *= factor;
        }
Пример #3
0
        private void OnCalibrationDataReceived(CalibrationData data)
        {
            if (!data.hasOpenCvPose)
            {
                return;
            }

            _hasCalibrationData = true;
            _calibratePos       = data.openCvFacePos;
            _calibrateRot       = Quaternion.Euler(data.openCvFaceRotEuler);
            _calibrateRotInv    = Quaternion.Inverse(_calibrateRot);
        }
Пример #4
0
            public override void LerpToDefault(CalibrationData calibration, float lerpFactor)
            {
                CurrentFaceRollRad = Mathf.Lerp(CurrentFaceRollRad, 0, lerpFactor);
                CurrentFaceRollSin = Mathf.Sin(CurrentFaceRollSin);
                CurrentFaceRollCos = Mathf.Cos(CurrentFaceRollCos);
                CurrentFaceYawRate = Mathf.Lerp(CurrentFaceYawRate, 0, lerpFactor);

                float faceLen = Mathf.Sqrt(calibration.faceSize);

                FaceSize = Vector2.Lerp(FaceSize, new Vector2(faceLen, faceLen), lerpFactor);

                _headRollRad.OnNext(CurrentFaceRollRad);
                _headYawRate.OnNext(CurrentFaceYawRate);
            }
Пример #5
0
        private void OnCalibrationRequired(CalibrationData data)
        {
            //TODO: 現在値さえ保存してればいいんだっけ、というのは実態に合わせて直す。多分大丈夫なはずだけど
            if (!_estimator.HasValidPoseData)
            {
                data.hasOpenCvPose = false;
                return;
            }

            _hasCalibrationData = true;
            _calibratePos       = _estimator.HeadPosition;
            _calibrateRot       = _estimator.HeadRotation;
            _calibrateRotInv    = Quaternion.Inverse(_calibrateRot);

            data.hasOpenCvPose      = true;
            data.openCvFacePos      = _calibratePos;
            data.openCvFaceRotEuler = _calibrateRot.eulerAngles;
        }
Пример #6
0
 public override void LerpToDefault(CalibrationData calibration, float lerpFactor)
 {
     //何もしない: そもそもプロパティとして外に出してない
 }
Пример #7
0
 public override void LerpToDefault(CalibrationData calibration, float lerpFactor)
 {
     CurrentEyeOpenValue = Mathf.Lerp(CurrentEyeOpenValue, calibration.eyeOpenHeight, lerpFactor);
     _eyeOpenValue.OnNext(CurrentEyeOpenValue);
 }
Пример #8
0
 public override void LerpToDefault(CalibrationData calibration, float lerpFactor)
 {
     CurrentNoseBaseHeightValue = Mathf.Lerp(CurrentNoseBaseHeightValue, calibration.noseHeight, lerpFactor);
     _noseBaseHeightValue.OnNext(CurrentNoseBaseHeightValue);
 }
Пример #9
0
 //NOTE: キャリブ情報には両眉の平均値が載っているので、リセット時は平均値を両方に当て込めばOK
 public override void LerpToDefault(CalibrationData calibration, float lerpFactor)
 {
     CurrentHeight = Mathf.Lerp(CurrentHeight, calibration.eyeBrowPosition, lerpFactor);
     _height.OnNext(CurrentHeight);
 }
Пример #10
0
 /// <summary> パーツの値を基準値まで戻す。このとき、必要ならばキャリブデータを参照してもよい。 </summary>
 public abstract void LerpToDefault(CalibrationData calibration, float lerpFactor);