Exemple #1
0
        private void OnFiredGesture(PXCMHandData.GestureData gestureData)
        {
            int side = Array.IndexOf(side2id, gestureData.handId);

            if (gestureData.name == "v_sign" && !playEnsemble)
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    StartEnsemble();
                }));
                playEnsemble = true;
            }
            if (gestureData.name == "thumb_up" && gestureTimer.ElapsedMilliseconds > 1000)
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    InstrumentsList.SelectedIndex = (InstrumentsList.SelectedIndex + 1) % InstrumentsList.Items.Count;
                }));
            }
            if (gestureData.name == "thumb_down" && gestureTimer.ElapsedMilliseconds > 1000)
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    InstrumentsList.SelectedIndex--;
                }));
            }
            gestureTimer.Restart();
        }
Exemple #2
0
    public void DisplayGestures(PXCMHandData.GestureData _gestureData)
    {
        gestureData = _gestureData;

        //		myGestureTextLeft.GetComponent<Text> ().text = "Left Hand: " + getLeftHandGesture ();
        //		myGestureTextRight.GetComponent<Text> ().text = "Right Hand: " + getRightHandGesture ();

        for (int i = 0; i < MaxHands; i++)
        {
            if (gestureData.handId == handIds[i])
            {
                if (bodySide[i] == PXCMHandData.BodySideType.BODY_SIDE_LEFT)
                {
                    lefthandgesture = gestureData.name.ToString();
                    //				myGestureTextLeft.GetComponent<Text>().text =  "Left Hand : "+ gestureData.name.ToString();
//					if(detectedLeftGestures.Count >= AveragedFrameCount)
//						detectedLeftGestures.Dequeue();
//					detectedLeftGestures.Enqueue(stringGestureMap[lefthandgesture]);
                    //				myGestureTextLeft.GetComponent<Text>().text =  "Left Hand : "+ getAveragedLeftHandGesture()+"-"+gestureData.name.ToString();
                }
                else if (bodySide[i] == PXCMHandData.BodySideType.BODY_SIDE_RIGHT)
                {
                    righthandgesture = gestureData.name.ToString();
                    //				myGestureTextRight.GetComponent<Text>().text = "Right Hand : "+ gestureData.name.ToString();
//					if(detectedRightGestures.Count >= AveragedFrameCount)
//						detectedRightGestures.Dequeue();
//					detectedRightGestures.Enqueue(stringGestureMap[righthandgesture]);
                    //				myGestureTextRight.GetComponent<Text>().text = "Right Hand : "+ getAveragedRightHandGesture()+"-"+gestureData.name.ToString();
                }
                break;
            }
        }
    }
Exemple #3
0
 void OnGesture(PXCMHandData.GestureData gestureData)
 {
     if ((gestureData.name == "click") &&
         (this.displayMode == DisplayMode.Pictures))
     {
         this.clickWaiting = true;
     }
     else if ((gestureData.name == "wave") &&
              (this.displayMode == DisplayMode.Highlight))
     {
         this.swipeDownWaiting = true;
     }
 }
Exemple #4
0
        private void onFiredGesture(PXCMHandData.GestureData gestureData)
        {
            if (gestureData.name.CompareTo("spreadfingers") == 0 && this.isPlaying)
            {
                this.BackColor = Color.Red;
                this.TogglePlay();
            }

            if (gestureData.name.CompareTo("thumb_up") == 0 && !this.isPlaying)
            {
                this.BackColor = Color.Green;
                this.TogglePlay();
            }
        }
Exemple #5
0
        private void OnGesture(PXCMHandData.GestureData gesturedata)
        {
            string g = $"Gesture: {gesturedata.name}-{gesturedata.handId}-{gesturedata.state}";

            Debug.WriteLine(g);
            switch (gesturedata.name)
            {
            case "wave":
                //_gestures.OnWave(new GestureEventArgs("wave"));
                return;
                //case "swipe_left":
                //    _sensor.OnSlideLeft(new GestureEventArgs("Swipe Left"));
                //    return;
            }
        }
Exemple #6
0
        //RealSenseイベント-------------------------------------------------------------------

        /// <summary>
        /// ジェスチャーが呼び出された時のイベント
        /// </summary>
        /// <param name="data"></param>
        void OnFiredGesture(PXCMHandData.GestureData data)
        {
            /*
             * if (data.name.CompareTo("v_sign") == 0 && !playstart)
             * {
             *  UpdateNTPTime();
             *  string target = SetTarget();
             *  var list = bWindow.bServerList;
             *  for (int i = 0; i < list.Count; i++)
             *  {
             *      list[i].StartMidi(target);
             *  }
             *  Dispatcher.BeginInvoke(
             * new Action(() =>
             * {
             *  ////bWindow.StartMidiButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
             * }
             * ));
             *  //playstart = true;
             * }
             * if (data.name.CompareTo("thumb_up") == 0)
             * {
             *  Dispatcher.BeginInvoke(
             * new Action(() =>
             * {
             *  //Major.IsChecked = true;
             * }
             * ));
             * }
             * if (data.name.CompareTo("thumb_down") == 0)
             * {
             *  Dispatcher.BeginInvoke(
             *              new Action(() =>
             *              {
             *                  //Minor.IsChecked = true;
             *              }
             *              ));
             * }
             * if (data.name.CompareTo("fist") == 0)
             * {
             *  //StopMIDI();
             * }
             * if (data.name.CompareTo("tap") == 0)
             * {
             *  midiManager.SetOnNote(player.MusicTime);
             * }
             */
        }
    //Display Gestures
    void DisplayGestures(PXCMHandData.GestureData gestureData)
    {
        if (handList.ContainsKey(gestureData.handId))
        {
            switch ((PXCMHandData.BodySideType)handList[gestureData.handId])
            {
            case PXCMHandData.BodySideType.BODY_SIDE_LEFT:
                myTextLeft.text = gestureData.name.ToString();
                break;

            case PXCMHandData.BodySideType.BODY_SIDE_RIGHT:
                myTextRight.text = gestureData.name.ToString();
                break;
            }
        }
    }
Exemple #8
0
        private void OnGesture(PXCMHandData.GestureData gesturedata)
        {
            string g = String.Format("Gesture: {0}-{1}-{2}",
                                     gesturedata.name,
                                     gesturedata.handId,
                                     gesturedata.state);

            if (_last == g)
            {
                return;
            }
            _last = g;
            //Debug.WriteLine(g);
            switch (gesturedata.name)
            {
            case "wave":
                _gestures.OnWave(new GestureEventArgs("wave"));
                return;
            }
        }
Exemple #9
0
        pxcmStatus newHandFrame(PXCMHandModule hand)
        {
            if (hand != null)
            {
                PXCMHandData handData = hand.CreateOutput();
                handData.Update();

                PXCMHandData.IHand     iHandDataLeft = null, iHandDataRight = null;
                PXCMHandData.JointData jointData = null;
                PXCMImage image = null;

                handData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_LEFT_HANDS, 0, out iHandDataLeft);
                handData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_RIGHT_HANDS, 0, out iHandDataRight);
                if (handForm != null && !handForm.IsDisposed)
                {
                    this.handForm.HandCount = handData.QueryNumberOfHands();
                    if (iHandDataLeft != null)
                    {
                        iHandDataLeft.QuerySegmentationImage(out image);
                        if (image != null)
                        {
                            PXCMImage.ImageData data = new PXCMImage.ImageData();
                            image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, out data);
                            handForm.LeftHand = data.ToBitmap(0, image.info.width, image.info.height);
                            image.ReleaseAccess(data);
                        }
                    }
                    if (iHandDataRight != null)
                    {
                        iHandDataRight.QuerySegmentationImage(out image);
                        if (image != null)
                        {
                            PXCMImage.ImageData data = new PXCMImage.ImageData();
                            image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, out data);
                            handForm.RightHand = data.ToBitmap(0, image.info.width, image.info.height);
                            image.ReleaseAccess(data);
                        }
                    }
                }
                if (iHandDataLeft != null)
                {
                    if (jointData == null)
                    {
                        iHandDataLeft.QueryTrackedJoint(PXCMHandData.JointType.JOINT_INDEX_TIP, out jointData);
                    }
                }
                if (iHandDataRight != null)
                {
                    if (jointData == null)
                    {
                        iHandDataRight.QueryTrackedJoint(PXCMHandData.JointType.JOINT_INDEX_TIP, out jointData);
                    }
                }
                if (jointData != null && canTrack.Checked)
                {
                    Cursor.Position = new System.Drawing.Point(
                        (int)((640.0f - jointData.positionImage.x) * Screen.PrimaryScreen.Bounds.Width / 640.0f),
                        (int)(jointData.positionImage.y * Screen.PrimaryScreen.Bounds.Height / 480.0f));
                    PXCMHandData.GestureData gestureData = null;
                    if (handData.IsGestureFired("two_fingers_pinch_open", out gestureData))
                    {
                        Program.DoMouseClick();
                    }
                    Console.WriteLine("Z Position: " + jointData.positionWorld.z);
                }

                handData.Dispose();
            }
            return(pxcmStatus.PXCM_STATUS_NO_ERROR);
        }
Exemple #10
0
 //Display Gestures
 void DisplayGestures(PXCMHandData.GestureData gestureData)
 {
     myTextLeft.text = gestureData.name.ToString();
 }
 public RealSenseGestureEventArgs(PXCMHandData.GestureData gestureData, PXCMHandData.BodySideType bodySide)
     : this()
 {
     this.gestureData = gestureData;
     this.bodySide = bodySide;
 }
 public RealSenseGestureEventArgs(PXCMHandData.GestureData gestureData)
     : this()
 {
     this.gestureData = gestureData;
 }
Exemple #13
0
 private void onFiredGesture(PXCMHandData.GestureData gestureData)
 {
     Debug.WriteLine("GESTURE::!!:: " + gestureData.name);
 }