Пример #1
0
        public ImageTracker(string name)
            : base()
        {
            Console.WriteLine("MyImage created");
            this.name = name;
            pushDetector = new PushDetector();
            circleDetector = new CircleDetector();
            circleDetector.MinimumPoints = 50;
            steadyDetector = new SteadyDetector();

            flowRouter = new FlowRouter();
            broadcaster = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(circleDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push += new EventHandler<VelocityAngleEventArgs>(pushDetector_Push);
            steadyDetector.Steady += new EventHandler<SteadyEventArgs>(steadyDetector_Steady);
            circleDetector.OnCircle += new EventHandler<CircleEventArgs>(circleDetector_OnCircle);

            PrimaryPointCreate += new EventHandler<HandFocusEventArgs>(MyBox_PrimaryPointCreate);
            PrimaryPointDestroy += new EventHandler<IdEventArgs>(MyBox_PrimaryPointDestroy);
            PrimaryPointUpdate += new EventHandler<HandEventArgs>(MyBox_PrimaryPointUpdate);
            OnUpdate += new EventHandler<UpdateMessageEventArgs>(MyBox_OnUpdate);
        }
Пример #2
0
        /// <summary>
        /// Setup builds an XN Context, Session Manager and all the detectors.
        /// It also adds the callbacks for the SessionManager and adds the listeners on the Broadcaster.
        /// </summary>
        private void Setup()
        {
            //build the context
            Context = new Context(CONFIG);
            //build session manager
            SeshManager = new SessionManager(Context, "RaiseHand", "RaiseHand");
            SeshManager.SetQuickRefocusTimeout(15000);

            //build the detectors
            Pushy = new PushDetector();
            Swipy = new SwipeDetector();
            //setup all the callbacks
            SetupCallbacks();
            SeshManager.SessionStart += SessionStarted;
            //add the flow router to the session
            SeshManager.AddListener(Pushy);
            SeshManager.AddListener(Swipy);
        }
Пример #3
0
        public HandData()
            : base()
        {
            Console.WriteLine("Constructing MyCanvas");
            pushDetector = new PushDetector();
            swipeDetector = new SwipeDetector();
            steadyDetector = new SteadyDetector();
            flowRouter = new FlowRouter();
            broadcaster = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push += new EventHandler<VelocityAngleEventArgs>(pushDetector_Push);
            steadyDetector.Steady += new EventHandler<SteadyEventArgs>(steadyDetector_Steady);
            swipeDetector.GeneralSwipe += new EventHandler<DirectionVelocityAngleEventArgs>(swipeDetector_GeneralSwipe);

            PrimaryPointCreate += new EventHandler<HandFocusEventArgs>(MyCanvas_PrimaryPointCreate);
            PrimaryPointDestroy += new EventHandler<IdEventArgs>(MyCanvas_PrimaryPointDestroy);
            PrimaryPointUpdate += new EventHandler<HandEventArgs>(MyCanvas_PrimaryPointUpdate);
            OnUpdate += new EventHandler<UpdateMessageEventArgs>(MyCanvas_OnUpdate);
        }
Пример #4
0
        public MyBox(System.Windows.Forms.Panel box, string name) :
            base()
        {
            this.name = name;
            this.box = box;

            pushDetector = new PushDetector();
            swipeDetector = new SwipeDetector();
            steadyDetector = new SteadyDetector();
            flowRouter = new FlowRouter();
            broadcaster = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push +=new EventHandler<VelocityAngleEventArgs>(pushDetector_Push);
            steadyDetector.Steady += new EventHandler<SteadyEventArgs>(steadyDetector_Steady);
            swipeDetector.GeneralSwipe += new EventHandler<DirectionVelocityAngleEventArgs>(swipeDetector_GeneralSwipe);

            PrimaryPointCreate += new EventHandler<HandFocusEventArgs>(MyBox_PrimaryPointCreate);
            PrimaryPointDestroy += new EventHandler<IdEventArgs>(MyBox_PrimaryPointDestroy);
            OnUpdate += new EventHandler<UpdateMessageEventArgs>(MyBox_OnUpdate);
        }
Пример #5
0
        public MyBox(System.Windows.Forms.Panel box, string name) :
            base()
        {
            this.name = name;
            this.box  = box;

            pushDetector   = new PushDetector();
            swipeDetector  = new SwipeDetector();
            steadyDetector = new SteadyDetector();
            flowRouter     = new FlowRouter();
            broadcaster    = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push          += new PushDetector.PushHandler(pushDetector_Push);
            steadyDetector.Steady      += new SteadyDetector.SteadyHandler(steadyDetector_Steady);
            swipeDetector.GeneralSwipe += new SwipeDetector.GeneralSwipeHandler(swipeDetector_GeneralSwipe);

            PrimaryPointCreate  += new PrimaryPointCreateHandler(MyBox_PrimaryPointCreate);
            PrimaryPointDestroy += new PrimaryPointDestroyHandler(MyBox_PrimaryPointDestroy);
            OnUpdate            += new UpdateHandler(MyBox_OnUpdate);
        }
Пример #6
0
        public MyBox(System.Windows.Forms.Panel box, string name) :
            base()
        {
            this.name = name;
            this.box  = box;

            pushDetector   = new PushDetector();
            swipeDetector  = new SwipeDetector();
            steadyDetector = new SteadyDetector();
            flowRouter     = new FlowRouter();
            broadcaster    = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push          += new EventHandler <VelocityAngleEventArgs>(pushDetector_Push);
            steadyDetector.Steady      += new EventHandler <SteadyEventArgs>(steadyDetector_Steady);
            swipeDetector.GeneralSwipe += new EventHandler <DirectionVelocityAngleEventArgs>(swipeDetector_GeneralSwipe);

            PrimaryPointCreate  += new EventHandler <HandFocusEventArgs>(MyBox_PrimaryPointCreate);
            PrimaryPointDestroy += new EventHandler <IdEventArgs>(MyBox_PrimaryPointDestroy);
            OnUpdate            += new EventHandler <UpdateMessageEventArgs>(MyBox_OnUpdate);
        }
Пример #7
0
        /// <summary>
        /// Setup builds an XN Context, Session Manager and all the detectors. 
        /// It also adds the callbacks for the SessionManager and adds the listeners on the Broadcaster. 
        /// </summary>
        private void Setup()
        {
            //build the context
            Context = new Context(CONFIG);
            //build session manager
            SeshManager = new SessionManager(Context,"RaiseHand","RaiseHand");
            SeshManager.SetQuickRefocusTimeout(15000);

            //build the detectors
            Pushy = new PushDetector();
            Swipy = new SwipeDetector();
            //setup all the callbacks
            SetupCallbacks();
            SeshManager.SessionStart += SessionStarted;
            //add the flow router to the session
            SeshManager.AddListener(Pushy);
            SeshManager.AddListener(Swipy);
        }
Пример #8
0
 /// base constructor
 public NIPushTracker()
 {
     NIOpenNICheckVersion.Instance.ValidatePrerequisite();
     m_pushDetector       = new PushDetector();
     m_pushDetector.Push += new System.EventHandler <VelocityAngleEventArgs>(PushDetected);
 }
Пример #9
0
        //constructor function
        public ViewingPaneForm()
        {
            InitializeComponent();

            #region Initializations
            CheckForIllegalCrossThreadCalls = false;
            this.context                  = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out this.scriptNode);
            this.sessionManager           = new NITE.SessionManager(this.context, "Wave,Click", "RaiseHand");
            this.Instruction_Display.Text = "Connected to the Kinect Camera";
            this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            if (this.depth == null)
            {
                throw new Exception("Viewer must have a depth node!");
            }
            this.hands = context.FindExistingNode(NodeType.Hands) as HandsGenerator;
            this.hands.SetSmoothing(0.8f);
            #endregion

            #region Setup Components
            pushDetector    = new PushDetector("PushDetector");
            aux_pushDect    = new PushDetector("Auxilary Push Detector");
            slider          = new SelectableSlider1D(1, Axis.X);
            swipeDetector   = new SwipeDetector("SwipeDectector");
            steadyDetector  = new SteadyDetector(350, 15);
            broadcaster     = new Broadcaster("Broadcaster");
            aux_broadcaster = new Broadcaster("Auxilary Broadcaster");
            router          = new FlowRouter("router");
            #endregion

            #region SignalRouting
            this.sessionManager.AddListener(this.router);
            this.router.ActiveListener = this.steadyDetector;

            this.broadcaster.AddListener(pushDetector);
            this.broadcaster.AddListener(swipeDetector);

            this.aux_broadcaster.AddListener(this.slider);
            this.aux_broadcaster.AddListener(this.aux_pushDect);
            #endregion

            #region SetUp Drawing Function
            this.histogram = new int[this.depth.DeviceMaxDepth];
            MapOutputMode mapMode = this.depth.MapOutputMode;
            this.bitmap       = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            this.shouldRun    = true;
            this.readerThread = new Thread(RenderThread);
            this.readerThread.Start();
            #endregion

            #region setProp values

            vars = new configurationVars();
            this.sessionManager.PrimaryStaticTimeout = 7;
            vars.SteadyReq        = 1000;
            vars.SteadyStddevReq  = 1;
            vars.SwipeVelmin      = 0.2f;
            vars.SwipeMinDuration = 500;
            vars.SwipeXangle      = 45;
            vars.SwipeYangle      = 45;
            vars.CircleMaxError   = 2;
            vars.CircleRadMin     = 80;
            vars.SliderHeight     = 100;
            vars.SliderWidth      = 200;
            vars.SwipeUseSteady   = true;
            vars.SwipeSteadyDur   = 75;

            this.populateConfiguration();
            this.customizeSwipe();
            this.customizeSteady();
            this.customizeCircle();
            #endregion

            #region Event Registration
            this.sessionManager.SessionStart         += new EventHandler <PositionEventArgs>(sessionManager_SessionStart);
            this.sessionManager.SessionFocusProgress += new EventHandler <SessionProgressEventArgs>(sessionManager_SessionFocusProgress);
            this.sessionManager.SessionEnd           += new EventHandler(sessionManager_SessionEnd);
            this.hands.HandDestroy        += new EventHandler <HandDestroyEventArgs>(hands_HandDestroy);
            this.hands.HandCreate         += new EventHandler <HandCreateEventArgs>(hands_HandCreate);
            this.pushDetector.Push        += new EventHandler <VelocityAngleEventArgs>(pushDetector_Push);
            this.swipeDetector.SwipeRight += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeRight);
            this.swipeDetector.SwipeLeft  += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeLeft);
            this.swipeDetector.SwipeUp    += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeUp);
            this.swipeDetector.SwipeDown  += new EventHandler <VelocityAngleEventArgs>(swipeDetector_SwipeDown);
            this.steadyDetector.Steady    += new EventHandler <SteadyEventArgs>(steadyDetector_Steady);
            this.slider.ValueChange       += new EventHandler <ValueEventArgs>(slider_ValueChange);
            this.aux_pushDect.Push        += new EventHandler <VelocityAngleEventArgs>(aux_pushDect_Push);


            //aux_pushDect.
            #endregion
        }
Пример #10
0
        public MyBox(System.Windows.Forms.Panel box, string name)
            : base()
        {
            this.name = name;
            this.box = box;

            pushDetector = new PushDetector();
            swipeDetector = new SwipeDetector();
            steadyDetector = new SteadyDetector();
            flowRouter = new FlowRouter();
            broadcaster = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push += new PushDetector.PushHandler(pushDetector_Push);
            steadyDetector.Steady += new SteadyDetector.SteadyHandler(steadyDetector_Steady);
            swipeDetector.GeneralSwipe += new SwipeDetector.GeneralSwipeHandler(swipeDetector_GeneralSwipe);

            PrimaryPointCreate += new PrimaryPointCreateHandler(MyBox_PrimaryPointCreate);
            PrimaryPointDestroy += new PrimaryPointDestroyHandler(MyBox_PrimaryPointDestroy);
            OnUpdate += new UpdateHandler(MyBox_OnUpdate);
        }