Stuck at how to continue

Nov 17, 2011 at 2:53 PM

Hi I'm new with this kinect sdk and im trying to implement gestures to my program

thus i saw your project and started experimenting with it. so after i have record the gesture, and save it what should i do or how i put it into my program..

and lastly i realize that im having some trouble with the main window program, each time i click on 'load gesture file' or 'save to file' the program crash

Please help..

Thank You

Nov 18, 2011 at 6:40 AM

Hi,

you can simply test the project by just capturing a gesture (without saving it to a file). Lets say you capture a gesture for "@Right hand swipe left". After capturing the gesture you can just repeat the gesture and you should see the result in the textbox right under the combobox.

I assume your mainwindow crashes becaus you unpacked the project in a different directory. Have a look in the MainWindow-class. Somewhere at the beginning there must be a definition of the filelocation.

/// <summary>
/// Where we will save our gestures to. The app will append a data/time and .txt to this string
/// </summary>
private const string GestureSaveFileLocation = @"H:\My Dropbox\Dropbox\Microsoft Kinect SDK Beta\DTWGestureRecognition\DTWGestureRecognition\";

The program may crash because there is no such filelocation on your computer. Just change the filelocation to some other location on your computer. Maybe its a good idea to make the path relative in the next release?

Kind regards 

Nov 19, 2011 at 9:07 AM

Hi 

Thanks for the reply & i have fix the crashes..

But after i capture and save the gesture to a text file how do i use it for my program..

Thanks

Irfan

Nov 19, 2011 at 9:27 AM

Hi,

I guess I'm not sure what you're trying to do. What do you mean with "... how do i use it for my programm."?

If you're having another programm and you want to use this DTW-gesturerecognition, you're suppost to insert the relevant parts for the gesturerecognition in your application.

If you're trying to use the actual DTWGestureRecognition-project, you're suppost to load your gesturefile.

Nov 19, 2011 at 10:33 AM

Hi,

I'm doing a kinect mouse program so i need gestures to do the 'clicks'.

let say how do i use the right hand swipes for this program after its recorded in the DTW

Nov 29, 2011 at 4:50 AM

Hi

Check out this: http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor

they provide C# source and it works just fine with me. Simply do the check where you got the gesture name and implement the mouse click there. Hope this helps =)

Jan 28, 2012 at 10:39 AM

Hi,

i m doing a project on Gesture Recognizing Robot wherein i m trying to command my robot using gestures.

we recieved the msg gestures loaded bt whr exactly are they loaded? can we c any change in the script?

also how do we use them to command the bot?

Apr 19, 2014 at 6:27 PM
Edited Apr 19, 2014 at 6:28 PM
I want to do like irfan82000. I would like either put my code inside the project and make something when my gesture is recognised, or insert the part of the code which recognised the gestures. Someone could help me ?

By the way, I saw one guys who modified this code, and when I re open the application, he don't have to re load all the txt file one by one, but juste one texte file, have a look here : WebSite

Thank you.
Apr 22, 2014 at 3:26 PM
After several test, I find where and how to do it!
For people who want this is in the NuiSkeleton2DdataCoordReady method (from MainWindows.xaml.cs).
 private void NuiSkeleton2DdataCoordReady(object sender, Skeleton2DdataCoordEventArgs a)
        {
            currentBufferFrame.Text = _video.Count.ToString();
            
            // We need a sensible number of frames before we start attempting to match gestures against remembered sequences
            if (_video.Count > MinimumFrames && _capturing == false)
            {
                ////Debug.WriteLine("Reading and video.Count=" + video.Count);
                string s = _dtw.Recognize(_video);
                results.Text = "Recognised as: " + s;
                if (!s.Contains("__UNKNOWN"))
                {
                    // There was no match so reset the buffer
                    _video = new ArrayList();
                    
                    //Turn on led
                    switch (_dtw.classification)
                    {
                        case "@Right hand swipe right": Serial.writeSerial("1");
                            break;
                        case "@Right hand swipe left": Serial.writeSerial("2");
                            break;
                        case "@Left hand swipe right": Serial.writeSerial("3");
                            break;
                        case "@Left hand swipe left": Serial.writeSerial("4");
                            break;
                        case "@Two hands zoom in": Serial.writeSerial("5");
                            break;
                        case "@Two hands zoom out": Serial.writeSerial("6");
                            break;
                        case "@Right hand wave": Serial.writeSerial("7");
                            break;
                        case "@Left hand wave": Serial.writeSerial("8");
                            break;

                        //case "@Right hand pull down": Serial.writeSerial("");
                        //    break;
                        //case "@Right hand push up": Serial.writeSerial("");
                        //    break;
                        //case "@Left hand pull down": Serial.writeSerial("");
                        //    break;
                        //case "@Left hand push up": Serial.writeSerial("");
                        //    break;
                        //case "@Both hands pull down": Serial.writeSerial("");
                        //    break;
                        //case "@Both hands push up": Serial.writeSerial("");
                        //    break;
                        //case "@Left hand push up": Serial.writeSerial("");
                        //    break;
                        //case "@Get on down at the disco!": Serial.writeSerial("");
                        //    break;
                    }
                }
            }
In fact, the string classification contains the name of the gesture which just been recognized.
Classification is state in the class DtwGestureRecognizer.cs, in the following methods : Recognize(ArrayList seq)
        public string classification = "__UNKNOWN";
        public string Recognize(ArrayList seq)
        {            
            double minDist = double.PositiveInfinity;
            //string classification = "__UNKNOWN";
            for (int i = 0; i < _sequences.Count; i++)
            {
                var example = (ArrayList) _sequences[i];
                ////Debug.WriteLine(Dist2((double[]) seq[seq.Count - 1], (double[]) example[example.Count - 1]));
                if (Dist2((double[]) seq[seq.Count - 1], (double[]) example[example.Count - 1]) < _firstThreshold)
                {
                    double d = Dtw(seq, example) / example.Count;
                    if (d < minDist)
                    {
                        minDist = d;
                        classification = (string)_labels[i];
                    }
                }
            }
            return (minDist < _globalThreshold ? classification : "__UNKNOWN") + " " /*+minDist.ToString()*/;
        }
So this is how to do.... I know it's a bit late, but nobody answer to this.

By the way if someone knows how to improve the code, because the recorded gesture aren't "absolute", there a relative at the environment. I want to means by this, you have to use the recorded gesture exactly with the same configuration when you recorded them (Position of the kinect and your body)...