Ejemplo n.º 1
0
        private void HdFaceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;

            this.faceModel = modelData.ProduceFaceModel();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;
        }
Ejemplo n.º 2
0
        private void HdFaceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;

            this.ModelBuilder.CollectionCompleted -= this.HdFaceBuilder_CollectionCompleted;
            CreateFaceModel(modelData);


            this.CollectionEventCalled = true;
        }
Ejemplo n.º 3
0
        void faceModelBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;

            faceModel = modelData.ProduceFaceModel();
            produced  = true;

            faceModelBuilder.Dispose();
            faceModelBuilder = null;
        }
        /// <summary>
        /// This event fires when the face capture operation is completed
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void HdFaceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;

            this.currentFaceModel = modelData.ProduceFaceModel();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;

            this.CurrentBuilderStatus = "Capture Complete";
        }
Ejemplo n.º 5
0
        // This event fires when the face capture operation is completed

        private void HdFaceBuilder_CollectionCompleted(
            object sender, FaceModelBuilderCollectionCompletedEventArgs e
            )
        {
            var modelData = e.ModelData;

            _currentFaceModel = modelData.ProduceFaceModel();

            _faceModelBuilder.Dispose();
            _faceModelBuilder = null;

            _currentBuilderStatus    = "Capture Complete";
            _currentCollectionStatus = string.Empty;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This event fires when the face capture operation is completed
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void HdFaceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            Log.LogMessage("FaceTracking complete");
            if (OnAskIfCaptured != null)
            {
                OnAskIfCaptured(true, true, true, true, true);
            }

            var modelData = e.ModelData;

            this.currentFaceModel = modelData.ProduceFaceModel();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;

            //The kinect is done preparing here.
        }
Ejemplo n.º 7
0
        private void m_faceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var status = m_faceBuilder.CollectionStatus;

            //var captureStatus = m_faceBuilder.CaptureStatus;
            if (status == FaceModelBuilderCollectionStatus.Complete && m_faceBuildComplete)
            {
                try
                {
                    m_faceModel = e.ModelData.ProduceFaceModel();
                }
                catch (Exception ex)
                {
                    lblCollectionStatus.Text = "Error: " + ex.ToString();
                    lblStatus.Text           = "Restarting...";
                    m_faceBuildComplete      = false;
                    m_faceBuilderStarted     = false;
                    m_sensor.Close();
                    System.Threading.Thread.Sleep(1000);
                    m_sensor.Open();
                    return;
                }
                var skinColor = UIntToColor(m_faceModel.SkinColor);
                var hairColor = UIntToColor(m_faceModel.HairColor);

                var skinBrush = new SolidColorBrush(skinColor);

                var hairBrush = new SolidColorBrush(hairColor);

                skinColorCanvas.Background = skinBrush;

                lblSkinColor.Text += " " + skinBrush.ToString();

                hairColorCanvas.Background = hairBrush;

                lblHairColor.Text += " " + hairBrush.ToString();


                m_faceBuilderStarted = false;
                m_sensor.Close();
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// FaceModelBuilderがモデルの構築を完了したときのイベントを処理します
        /// </summary>
        private void OnModelBuilderCollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;

            this.faceModel = modelData.ProduceFaceModel();

            // MeshをUpdate
            UpdateMesh();

            // SkinColorとHairColorの値も更新
            this.SkinColor = UIntToColor(this.faceModel.SkinColor);
            this.HairColor = UIntToColor(this.faceModel.HairColor);

            // 更新を行う
            this.FaceModelBuilderStatus = GetCollectionStatus(((FaceModelBuilder)sender).CollectionStatus);
            this.FaceModelCaptureStatus = ((FaceModelBuilder)sender).CaptureStatus.ToString();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Called when face model collection is successful
        /// </summary>
        private void FaceModelBuilderCollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            // Unfortunately, running this in a background thread seems to cause frequent crashes from
            // the kinect face library.  I wish there was a better way...
            lock (this.processFaceModelMutex)
            {
                if (this.fmb == null)
                {
                    return;
                }

                this.constructionInProcess = true;

                this.fmb.CollectionCompleted -= this.FaceModelBuilderCollectionCompleted;
                this.constructedFaceModel     = e.ModelData.ProduceFaceModel();
                this.DisposeFaceModelBuilder();

                this.constructionInProcess = false;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// This event fires when the face capture operation is completed
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void HdFaceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            Log.LogMessage("FaceTracking complete");
            if (OnAskIfCaptured != null)
                OnAskIfCaptured(true, true, true, true, true);

            var modelData = e.ModelData;

            this.currentFaceModel = modelData.ProduceFaceModel();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;

            //The kinect is done preparing here.
        }
Ejemplo n.º 11
0
        void faceModelBuilder_CollectionCompleted( object sender, FaceModelBuilderCollectionCompletedEventArgs e )
        {
            var modelData = e.ModelData;
            faceModel = modelData.ProduceFaceModel();
            produced = true;

            faceModelBuilder.Dispose();
            faceModelBuilder = null;
        }
        /// <summary>
        /// FaceModelBuilderがモデルの構築を完了したときのイベントを処理します
        /// </summary>
        private void OnModelBuilderCollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;
            this.faceModel = modelData.ProduceFaceModel();
            
            // MeshをUpdate
            UpdateMesh();

            // SkinColorとHairColorの値も更新
            this.SkinColor = UIntToColor(this.faceModel.SkinColor);
            this.HairColor = UIntToColor(this.faceModel.HairColor);
            
            // 更新を行う
            this.FaceModelBuilderStatus = GetCollectionStatus(((FaceModelBuilder)sender).CollectionStatus);
            this.FaceModelCaptureStatus = ((FaceModelBuilder)sender).CaptureStatus.ToString();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;
        }
        /// <summary>
        /// This event fires when the face capture operation is completed
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void HdFaceBuilder_CollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            var modelData = e.ModelData;

            this.currentFaceModel = modelData.ProduceFaceModel();

            this.faceModelBuilder.Dispose();
            this.faceModelBuilder = null;

            this.CurrentBuilderStatus = "Capture Complete";
        }
        /// <summary>
        /// Called when face model collection is successful
        /// </summary>
        private void FaceModelBuilderCollectionCompleted(object sender, FaceModelBuilderCollectionCompletedEventArgs e)
        {
            // Unfortunately, running this in a background thread seems to cause frequent crashes from
            // the kinect face library.  I wish there was a better way...
            lock (this.processFaceModelMutex)
            {
                if (this.fmb == null)
                    return;

                this.constructionInProcess = true;

                this.fmb.CollectionCompleted -= this.FaceModelBuilderCollectionCompleted;
                this.constructedFaceModel = e.ModelData.ProduceFaceModel();
                this.DisposeFaceModelBuilder();

                this.constructionInProcess = false;
            }
        }