コード例 #1
0
 public PreposeGesturesFrameSource(KinectSensor sensor, ulong initialTrackingId)
 {
     KinectSensor = sensor;
     TrackingId   = initialTrackingId;
     Gestures     = new List <Gesture>();
     myMatcher    = new BodyMatcher(Gestures);
     myReader     = new PreposeGesturesFrameReader(this);
 }
コード例 #2
0
        public void Evaluate(int SpreadMax)
        {


            if (this.FInvalidateConnect)
            {
                if (this.FInRuntime.PluginIO.IsConnected)
                {
                    //Cache runtime node
                    this.runtime = this.FInRuntime[0];

                    if (runtime != null)
                    {
                        this.source = new PreposeGestures.PreposeGesturesFrameSource(this.runtime.Runtime, 0);
                        this.reader = this.source.OpenReader();
                        this.reader.FrameArrived += Reader_FrameArrived;
                        this.reader.IsPaused = true;
                    }
                }
                else
                {
                    //this.runtime.SkeletonFrameReady -= SkeletonReady;
                    this.reader.FrameArrived -= this.Reader_FrameArrived;
                    this.source.Dispose();

                }

                this.FInvalidateConnect = false;
            }

            if (this.source != null)
            {
                ulong id = 0;
                try
                {
                    id = ulong.Parse(this.FInId[0]);
                }
                catch
                {

                }
                this.source.TrackingId = id;
                this.reader.IsPaused = this.FInPaused[0];
            }

            if (this.FInScript.IsChanged)
            {

                try
                {
                    string str = this.FInScript[0];
                    var app = PreposeGestures.App.ReadAppText(str);

                    this.FOutGestures.SliceCount = app.Gestures.Count;
                    this.FOutGestures.AssignFrom(app.Gestures.Select(gs => gs.Name));



                    this.source.Gestures.Clear();
                    foreach (Gesture g in app.Gestures)
                    {
                        this.source.AddGesture(g);
                    }

                    this.FOutValid[0] = true;
                }
                catch
                {
                    this.FOutValid[0] = false;
                    this.source.Gestures.Clear();
                } 
            }

            if (this.source != null)
            {
                this.source.myMatcher.Precision = Convert.ToInt32(this.FInPrecision[0] * 100.0);

            }
            this.FOutPaused[0] = this.reader != null ? this.reader.IsPaused : true;
            this.FOuTrackingId[0] = this.source.TrackingId.ToString();
        }
コード例 #3
0
        public void Evaluate(int SpreadMax)
        {
            if (this.FInvalidateConnect)
            {
                if (this.FInRuntime.PluginIO.IsConnected)
                {
                    //Cache runtime node
                    this.runtime = this.FInRuntime[0];

                    if (runtime != null)
                    {
                        this.source = new PreposeGestures.PreposeGesturesFrameSource(this.runtime.Runtime, 0);
                        this.reader = this.source.OpenReader();
                        this.reader.FrameArrived += Reader_FrameArrived;
                        this.reader.IsPaused = true;
                    }
                }
                else
                {
                    //this.runtime.SkeletonFrameReady -= SkeletonReady;
                    this.reader.FrameArrived -= this.Reader_FrameArrived;
                    this.source.Dispose();

                }

                this.FInvalidateConnect = false;
            }

            if (this.source != null)
            {
                ulong id = 0;
                try
                {
                    id = ulong.Parse(this.FInId[0]);
                }
                catch
                {

                }
                this.source.TrackingId = id;
                this.reader.IsPaused = this.FInPaused[0];
            }

            if (this.FInScript.IsChanged)
            {
                string str = this.FInScript[0];
                var app = PreposeGestures.App.ReadAppText(str);

                this.FOutGestures.SliceCount = app.Gestures.Count;
                this.FOutGestures.AssignFrom(app.Gestures.Select(gs => gs.Name));

                this.source.Gestures.Clear();
                foreach (Gesture g in app.Gestures)
                {
                    this.source.AddGesture(g);
                }

            }

            this.source.myMatcher.Precision = Convert.ToInt32(this.FInPrecision[0] * 100.0);

            this.FOutPaused[0] = this.reader != null ? this.reader.IsPaused : true;
            this.FOuTrackingId[0] = this.source.TrackingId.ToString();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: caomw/prepose
        private void Initialize()
        {
            sensor = KinectSensor.GetDefault();
            bfr = sensor.BodyFrameSource.OpenReader();
            bfr.FrameArrived += bfr_FrameArrived;
            pgd = new PreposeGesturesDatabase("soccer.app");
            pgfs = new PreposeGesturesFrameSource(KinectSensor.GetDefault(), 0);

            foreach (var g in pgd.AvailableGestures)
            {
                if (g.Name.Equals("ola"))
                {
                    gesture = g;
                    pgfs.AddGesture(gesture);
                }
            }
            pgr = pgfs.OpenReader();
            pgfs.GetIsEnabled(gesture);
            pgr.FrameArrived += pgr_FrameArrived;
            sensor.Open();
        }
コード例 #5
0
 public PreposeGesturesFrameSource(KinectSensor sensor, ulong initialTrackingId)
 {
     KinectSensor = sensor;
     TrackingId = initialTrackingId;
     Gestures = new List<Gesture>();
     myMatcher = new BodyMatcher(Gestures);
     myReader = new PreposeGesturesFrameReader(this);
 }