Exemplo n.º 1
0
 void m_hdFaceReader_FrameArrived(object sender, HighDefinitionFaceFrameArrivedEventArgs e)
 {
     if (!m_faceBuilderStarted)
     {
         m_faceBuilder.BeginFaceDataCollection();
     }
 }
Exemplo n.º 2
0
        public override bool StartSensor()
        {
            _bodySource = _kinect.BodyFrameSource;
            _bodyReader = _bodySource.OpenReader();
            _bodyReader.FrameArrived += BodyReader_FrameArrived;

            _hdFaceFrameSource =
                new HighDefinitionFaceFrameSource(_kinect);
            _hdFaceFrameSource.TrackingIdLost +=
                HdFaceSource_TrackingIdLost;

            _hdFaceFrameReader =
                _hdFaceFrameSource.OpenReader();
            _hdFaceFrameReader.FrameArrived +=
                HdFaceReader_FrameArrived;

            _currentFaceModel     = new FaceModel();
            _currentFaceAlignment = new FaceAlignment();

            InitializeMesh();
            UpdateMesh();

            // Text style for our jig

            _style      = new TextStyle();
            _style.Font =
                new FontDescriptor("standard.shx", false, false, 0, 0);
            _style.TextSize = 10;

            var res = base.StartSensor();

            if (res)
            {
                if (_faceModelBuilder != null)
                {
                    _faceModelBuilder.Dispose();
                }
                _faceModelBuilder =
                    _hdFaceFrameSource.OpenModelBuilder(
                        FaceModelBuilderAttributes.None
                        );
                _faceModelBuilder.BeginFaceDataCollection();
                _faceModelBuilder.CollectionCompleted +=
                    HdFaceBuilder_CollectionCompleted;
            }
            return(res);
        }
Exemplo n.º 3
0
        public Face(KinectSensor sensor, BodyFrameReader bodyReader)
        {
            var bodySource = sensor.BodyFrameSource;

            bodyReader.FrameArrived += BodyReader_FrameArrived;

            highDefinitionFaceFrameSource = new HighDefinitionFaceFrameSource(sensor);
            highDefinitionFaceFrameSource.TrackingIdLost += HdFaceSource_TrackingIdLost;

            highDefinitionFaceFrameReader = highDefinitionFaceFrameSource.OpenReader();
            highDefinitionFaceFrameReader.FrameArrived += HdFaceReader_FrameArrived;

            currentFaceModel     = new FaceModel();
            currentFaceAlignment = new FaceAlignment();

            UpdateMesh();

            faceModelBuilder = highDefinitionFaceFrameSource.OpenModelBuilder(FaceModelBuilderAttributes.None);
            faceModelBuilder.BeginFaceDataCollection();
            faceModelBuilder.CollectionCompleted += HdFaceBuilder_CollectionCompleted;
        }
Exemplo n.º 4
0
        private void InitializeHDFace()
        {
            hdFaceFrameSource = new HighDefinitionFaceFrameSource(kinect);
            if (hdFaceFrameSource == null)
            {
                throw new Exception("Cannot create HD Face Frame Source");
            }
            hdFaceFrameReader = hdFaceFrameSource.OpenReader();
            hdFaceFrameReader.FrameArrived += hdFaceFrameReader_FrameArrived;
            faceModel     = new FaceModel();
            faceAlignment = new FaceAlignment();

            FaceModelBuilderAttributes attributes = FaceModelBuilderAttributes.None;

            faceModelBuilder = hdFaceFrameSource.OpenModelBuilder(attributes);
            if (faceModelBuilder == null)
            {
                throw new Exception("Cannot open Face Model Builder");
            }
            faceModelBuilder.BeginFaceDataCollection();
            faceModelBuilder.CollectionCompleted += faceModelBuilder_CollectionCompleted;
        }