Пример #1
0
        public Gesture(GestureType type, IGestureSegment[] segments)
        {
            _type     = type;
            _name     = type.ToString();
            _segments = segments;

            _name = type.ToString();
        }
Пример #2
0
        private static string CreateUriTo(GestureType type, GestureDirection direction)
        {
            string videoDirectory = @"techniques/" + direction.ToString() + "_" + type.ToString() + ".mp4";
            string path           = Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName, videoDirectory);

            return(new Uri(path).AbsoluteUri);
        }
Пример #3
0
        public Gesture(GestureType type, IGestureSegment[] segments)
        {
            _type = type;
            _segments = segments;

            _name = type.ToString();
        }
Пример #4
0
        public void StartPracticeTime(GestureType type, GestureDirection direction)
        {
            string message = "Started new gesture practice." +
                             " Type: " + type.ToString() +
                             " Direction: " + direction.ToString();

            Log(message);
        }
Пример #5
0
        /// <summary>
        /// Log that new gesture test has started
        /// </summary>
        /// <param name="gestureType"></param>
        /// <param name="gestureDirection"></param>
        public void StartNewgestureTest(GestureType gestureType, GestureDirection gestureDirection)
        {
            string message = "Started new gesture test." +
                             " Type: " + gestureType.ToString() +
                             " Direction: " + gestureDirection.ToString();

            Log(message);
        }
Пример #6
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.L))
            {
                if (recordingLeftHand)
                {
                    csvLeftWriter.Dispose();
                    recordingLeftHand      = false;
                    recordingLeftText.text = "Left Hand: Not Recording";
                }
                else
                {
                    InitialiseWriter(true, gesture);
                    recordingLeftHand      = true;
                    recordingLeftText.text = "Left Hand: Recording " + gesture.ToString();
                }
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                if (recordingRightHand)
                {
                    csvRightWriter.Dispose();
                    recordingRightHand      = false;
                    recordingRightText.text = "Right Hand: Not Recording";
                }
                else
                {
                    InitialiseWriter(false, gesture);
                    recordingRightHand      = true;
                    recordingRightText.text = "Right Hand: Recording " + gesture.ToString();
                }
            }

            if (recordingLeftHand)
            {
                WriteDataFrame(csvLeftWriter, leftHand, gesture);
            }

            if (recordingRightHand)
            {
                WriteDataFrame(csvRightWriter, rightHand, gesture);
            }
        }
Пример #7
0
        /// <summary>
        /// Fizbin gestures callback.
        /// </summary>
        /// <param name="gestureType">The gesture type</param>
        /// <param name="trackingID">The tracking ID</param>
        void KinectGestureGenerator_GestureRecognized(GestureType gestureType, int trackingID)
        {
            //This will call the KinectInfo constructor,
            //And then assign gestureType string to Gesture property.
            ServerMessage kinectInfo = new ServerMessage()
            {
                Gesture = gestureType.ToString()
            };

            Webserver.SendToClients(kinectInfo.ToJSON());
        }
Пример #8
0
        private void StartDebugTest(GestureType type)
        {
            if (connection == null || !connection.Connected)
            {
                connectedLabel.BeginAnimation(Canvas.OpacityProperty, CreateAnimation(5, 1, 0));
                return;
            }
            Logger.CurrentLogger.DebugMode = true;

            ShowStatusMessage(type.ToString());
            currentTest = new TestSuite(this, source);
            currentTest.StartDebugTest(type);
        }
        public void PushGesture(GestureType type, long epoch)
        {
            bool shouldBeServed = true;

            if (lastGestureTime.ContainsKey(type))
            {
                long lastEpoch = lastGestureTime[type];
                if (epoch - lastEpoch < TRESHOLD)
                {
                    shouldBeServed = false;
                }
            }

            if (shouldBeServed)
            {
                //send an action
                Console.WriteLine(type.ToString());
                lastGestureTime[type] = epoch;
            }
        }
Пример #10
0
        private void WriteDataFrame(CsvFileWriter writer, HI5_TransformInstance hand, GestureType gesture)
        {
            List <string> frame = new List <string>();

            foreach (var t in hand.HandBones)
            {
                if (recordPositions)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        frame.Add(t.localPosition[i].ToString());
                    }
                }
                for (int i = 0; i < 4; i++)
                {
                    frame.Add(t.localRotation[i].ToString());
                }
            }
            frame.Add(gesture.ToString());
            writer.WriteRow(frame);
            writer.Flush();
        }
Пример #11
0
 public void onGestureEvent(GestureType gestureID)
 {
     Debug.Log("BroadcastReceiver_onMudraGestureEvent called" + gestureID.ToString());
     gesture_text.text = gestureID.ToString();
 }
    private void CheckGetsturebyCoordinate()
    {
        if (!bStartCheck)
        {
            return;
        }
        // 1. 初始化数据表,并把数据转换到相机视口坐标系上。
        Vector3 currentRecordPos = transform.position;
        Vector3 currentWVPPos    = mainCamera.WorldToViewportPoint(currentRecordPos);

        if (!bInitialOnce)
        {
            bInitialOnce             = true;
            linkListMaxLength        = (int)(RecongnizeMinStepDistance / addListMinStepDist);
            linkListMaxLength        = linkListMaxLength < 5 ? 5 : linkListMaxLength; // 最小存5个数据
            recordPosList            = new List <Vector3>(linkListMaxLength);
            recordWorldToViewPosList = new List <Vector3>(linkListMaxLength);
            recordPosList.Add(currentRecordPos);
            recordWorldToViewPosList.Add(currentWVPPos);
            UpdateLenToCheck = (int)(linkListMaxLength * 0.4f);
            iNewAddCount     = 0;
        }

        //2. 数据加入,最小距离判断是否符合加入条件
        if (Vector3.Distance(recordPosList[recordPosList.Count - 1], currentRecordPos) > addListMinStepDist)
        {
            recordPosList.Add(currentRecordPos);
            recordWorldToViewPosList.Add(currentWVPPos);
            iNewAddCount++;
        }
        //3. list 的数据的添加和刷新,每次新入多少数据,重新开启检测。
        int currentListLen = recordPosList.Count;

        if (currentListLen >= linkListMaxLength)
        {
            // 刷新iNewAddCount个数据,再做检测。
            if (iNewAddCount > UpdateLenToCheck)
            {
                iNewAddCount = 0;
                // 4. 移动行程换算角度来做判断
                if (Vector3.Distance(recordPosList[0], recordPosList[currentListLen - 1]) > RecongnizeMinStepDistance * 0.3f)
                {
                    int middleIndex = currentListLen >> 1;
                    SamplePos[0] = (middleIndex <= 3) ? recordWorldToViewPosList[0]:
                                   (recordWorldToViewPosList[0] + recordWorldToViewPosList[1] + recordWorldToViewPosList[2]) / 3;
                    SamplePos[1] = (middleIndex <= 3) ? recordWorldToViewPosList[middleIndex]:
                                   (recordWorldToViewPosList[middleIndex - 1] + recordWorldToViewPosList[middleIndex] + recordWorldToViewPosList[middleIndex + 1]) / 3;
                    SamplePos[2] = (middleIndex <= 3) ? recordWorldToViewPosList[currentListLen - 1]:
                                   (recordWorldToViewPosList[currentListLen - 1] + recordWorldToViewPosList[currentListLen - 2]) / 2;
                    CalcuolateDirection();
                    showState.text = gestureType.ToString();
                    if (gestureType != GestureType.None)
                    {
                        Debug.Log("current recongnize gesture is " + gestureType.ToString());
                    }
                }
            }
            // 移除首位,并开始判断
            recordPosList.RemoveAt(0);
            recordWorldToViewPosList.RemoveAt(0);
            //Debug.Log("current recongnize gesture is " + gestureType.ToString());
        }
    }
Пример #13
0
 private static string CreateUriTo(GestureType type, GestureDirection direction)
 {
     string videoDirectory = @"techniques/" + direction.ToString() + "_" + type.ToString() + ".mp4";
     string path = Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName, videoDirectory);
     return new Uri(path).AbsoluteUri;
 }
Пример #14
0
 public override string ToString()
 {
     return(GestureType.ToString());
 }
Пример #15
0
 public void StartPracticeTime(GestureType type, GestureDirection direction)
 {
     string message = "Started new gesture practice." +
                      " Type: " + type.ToString() +
                      " Direction: " + direction.ToString();
     Log(message);
 }
Пример #16
0
 /// <summary>
 /// Log that new gesture test has started
 /// </summary>
 /// <param name="gestureType"></param>
 /// <param name="gestureDirection"></param>
 public void StartNewgestureTest(GestureType gestureType, GestureDirection gestureDirection)
 {
     string message = "Started new gesture test." +
                      " Type: " + gestureType.ToString() +
                      " Direction: " + gestureDirection.ToString();
     Log(message);
 }