Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of SensorData with the specified configuration file.
        /// </summary>
        /// <param name="configuration">Configuration file path.</param>
        public HandTracker(string configuration)
        {
            InitializeCamera(configuration);
            InitializeBitmaps();
            InitializeThread();

            this.DepthGenerator.AlternativeViewpointCapability.SetViewpoint(this.ImageGenerator);
            this.userGenerator = new UserGenerator(this.Context);
            this.skeletonCapbility = this.userGenerator.SkeletonCapability;
            this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability;
            this.calibPose = this.skeletonCapbility.CalibrationPose;
            this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected;
            this.skeletonCapbility.CalibrationComplete += skeletonCapbility_CalibrationComplete;

            this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All);
            this.joints = new Dictionary<int, Dictionary<SkeletonJoint, SkeletonJointPosition>>();

            this.sessionManager = new NITE.SessionManager(this.Context, "Wave,Click", "RaiseHand");
            _handsGenerator = new HandsGenerator(Context);
            _handsGenerator.SetSmoothing(0.1f);

            _gestureGenerator = new GestureGenerator(Context);

            this.Context.StartGeneratingAll();
            Console.WriteLine("Start Generating All");

            pointControl = new PointControl("PointTracker");
            pointControl.PointCreate += new EventHandler<HandEventArgs>(pointControl_PointCreate);
            pointControl.PointUpdate += new EventHandler<HandEventArgs>(pointControl_PointUpdate);
            pointControl.PointDestroy += new EventHandler<IdEventArgs>(pointControl_PointDestroy);
            sessionManager.AddListener(pointControl);

            this.userGenerator.NewUser += userGenerator_NewUser;
            this.userGenerator.LostUser += userGenerator_LostUser;
            this.userGenerator.StartGenerating();
        }