none
Discrete Gestures in Javascript project RRS feed

  • Question

  • Hi,

    I'm trying to create the same proyect as DiscreteGestureBasics(which is included as an example), but using a Javascript project. I'm trying to add the gestures from the gbd file to the frame source, but I get an error which says that there isn't any addGesture method available. Here is the code:

     
                  
    sensor.open();
    
    var vgBD = "swipe.gbd";
    var gestureBuilder = Microsoft.Kinect.VisualGestureBuilder;                
    var frameSource =gestureBuilder.VisualGestureBuilderFrameSource;                
    var database =gestureBuilder.VisualGestureBuilderDatabase(vgBD);          
    
    var availableGestures = database.availableGestures;          
    
    var slideLeft = (availableGestures[0]);
    var slideRight = (availableGestures[1]);
    
    var frameSource = sensor.bodyFrameSource;                
    
    console.log(frameSource.kinectSensor);
    console.log(frameSource.isActive);    
    console.log(frameSource.bodyCount);    
    console.log(frameSource.trackingId);
    
    frameSource.addGesture(slideLeft);

    Doing some checks I could found that I can retrieve gestures from the gdb file. So, I think that the problem is on the frame source.

    Finally, I have another question. Which is the difference between the microsoft.kinect and windowsPreview.Kinect? I mean, I know that they have diferent methods, but why such a similar name, and when should I use one, and when I should use the other?

    Thank you very much

    Monday, May 11, 2015 6:38 PM

Answers

  • I'am answering my own question just in case someone has the same problem. 

    The issue that I had is that you can't add a gesture to a

    bodyFrameSource

     like I intended to do. If you want to add a gesture, you need to create a

    visualGestureBuilderFrameSource

    and add the gesture to it.

    • Marked as answer by IvanRT Thursday, May 28, 2015 12:35 PM
    Thursday, May 28, 2015 12:35 PM

All replies

  • What is the exact error? What line of code is failing? Is it because it isn't finding your database file in the final appx package

    In either case, they are just namespaces, the API's are exactly the same. WindowsPreview namespace is reserved for use in Windows Store/Extensions. The differences account for not have direct access to raw buffers and opt for IBuffer's typically. The JavaScript functionality would use these since WinJS is a Windows Store application framework.

    Does the managed Discrete Gesture Baisics-XAML sample work?

    Understand the WinJS based applications may requires tweaks to improve performance so that not everything is done on the UI thread. You may need to wrap this in it own extension library similar to how some of the other samples are doing it.


    Carmine Sirignano - MSFT

    Tuesday, May 12, 2015 12:30 AM
  • The error happends in the last line, when I try to execute:  

    frameSource.addGesture(slideLeft);

    And the error is that frameSource has any addGesture() function defined. But I think that the problem is not with the database, because I can retrieve the gestures from it without any problem.

    Tuesday, May 12, 2015 8:24 AM
  • I'am answering my own question just in case someone has the same problem. 

    The issue that I had is that you can't add a gesture to a

    bodyFrameSource

     like I intended to do. If you want to add a gesture, you need to create a

    visualGestureBuilderFrameSource

    and add the gesture to it.

    • Marked as answer by IvanRT Thursday, May 28, 2015 12:35 PM
    Thursday, May 28, 2015 12:35 PM