public void Initialize(FaceTracker faceTracker, OpenCVFacePose openCvFacePose, IVRMLoadable vrmLoadable)
        {
            _faceTracker    = faceTracker;
            _faceRotToEuler = new FaceRotToEuler(openCvFacePose);

            vrmLoadable.VrmLoaded += info =>
            {
                var animator = info.animator;
                _neck     = animator.GetBoneTransform(HumanBodyBones.Neck);
                _head     = animator.GetBoneTransform(HumanBodyBones.Head);
                _hasNeck  = (_neck != null);
                _hasModel = true;
            };

            vrmLoadable.VrmDisposing += () =>
            {
                _hasModel = false;
                _hasNeck  = false;
                _neck     = null;
                _head     = null;
            };
        }
Пример #2
0
        public FaceTrackerReceiver(IMessageReceiver receiver, FaceTracker faceTracker)
        {
            _faceTracker = faceTracker;

            receiver.AssignCommandHandler(
                VmmCommands.SetCameraDeviceName,
                message => SetCameraDeviceName(message.Content)
                );
            receiver.AssignCommandHandler(
                VmmCommands.EnableFaceTracking,
                message => SetEnableFaceTracking(message.ToBoolean())
                );
            receiver.AssignCommandHandler(
                VmmCommands.EnableWebCamHighPowerMode,
                message => SetWebCamHighPowerMode(message.ToBoolean())
                );
            receiver.AssignCommandHandler(
                VmmCommands.ExTrackerEnable,
                message => SetEnableExTracker(message.ToBoolean())
                );
            receiver.AssignCommandHandler(
                VmmCommands.CalibrateFace,
                message => _faceTracker.StartCalibration()
                );
            receiver.AssignCommandHandler(
                VmmCommands.SetCalibrateFaceData,
                message => _faceTracker.SetCalibrateData(message.Content)
                );
            receiver.AssignCommandHandler(
                VmmCommands.DisableFaceTrackingHorizontalFlip,
                message => _faceTracker.DisableHorizontalFlip = message.ToBoolean()
                );

            receiver.AssignQueryHandler(
                VmmQueries.CameraDeviceNames,
                query => query.Result = string.Join("\t", GetCameraDeviceNames())
                );
        }
Пример #3
0
        private void Start()
        {
            _faceTracker = GetComponent <FaceTracker>();

            handler.Commands.Subscribe(message =>
            {
                switch (message.Command)
                {
                case MessageCommandNames.SetCameraDeviceName:
                    SetCameraDeviceName(message.Content);
                    break;

                case MessageCommandNames.EnableFaceTracking:
                    EnableFaceTracking(message.ToBoolean());
                    break;

                case MessageCommandNames.CalibrateFace:
                    _faceTracker.StartCalibration();
                    break;

                case MessageCommandNames.SetCalibrateFaceData:
                    _faceTracker.SetCalibrateData(message.Content);
                    break;

                case MessageCommandNames.DisableFaceTrackingHorizontalFlip:
                    _faceTracker.DisableHorizontalFlip = message.ToBoolean();
                    break;
                }
            });

            handler.QueryRequested += query =>
            {
                if (query.Command == MessageQueryNames.CameraDeviceNames)
                {
                    query.Result = string.Join("\t", GetCameraDeviceNames());
                }
            };
        }
Пример #4
0
        public void Initialize(
            IMessageReceiver receiver,
            IVRMLoadable vrmLoadable,
            FaceTracker faceTracker,
            DeviceSelectableLipSyncContext lipSync
            )
        {
            _faceTracker = faceTracker;

            receiver.AssignCommandHandler(
                VmmCommands.EnableVoiceBasedMotion,
                command => _operationEnabled = command.ToBoolean());

            _voiceOnOffParser = new VoiceOnOffParser(lipSync)
            {
                //そこそこちゃんと喋ってないと検出しない、という設定のつもり
                VisemeThreshold   = 0.2f,
                OnCountThreshold  = 6,
                OffCountThreshold = 16,
            };

            _motionApplier = new NonImageBasedMotionApplier(vrmLoadable);
        }
Пример #5
0
 public void Initialize(IMessageReceiver receiver, FaceTracker faceTracker)
 {
     _faceTracker = faceTracker;
     _faceTracker.FaceDetectionUpdated += OnFaceDetectionUpdated;
     var _ = new HandTrackerReceiver(receiver, this);
 }
Пример #6
0
 public void Initialize(FaceTracker faceTracker)
 {
     _faceTracker = faceTracker;
     _faceTracker.FaceDetectionUpdated += OnFaceDetectionUpdated;
 }