12
Advanced Kinect Tricks

Advanced Kinect Tricks

  • Upload
    peri

  • View
    42

  • Download
    2

Embed Size (px)

DESCRIPTION

Advanced Kinect Tricks. Shapes Game. Goal is to demonstrate how to create a simple game that uses Kinect audio and skeletal tracking information The game displays the tracked skeleton of the players and shapes (circles , triangles , stars, and so on) falling from the sky. Players can - PowerPoint PPT Presentation

Citation preview

Visual Studio, C#, and Kinect SDK Installation

Advanced Kinect TricksShapes GameGoal is to demonstrate how to create a simple game that uses Kinect audio and skeletal tracking information

The game displays the tracked skeleton of the players and shapes (circles, triangles, stars, and so on) falling from the sky. Players can move their limbs to make shapes change direction or even explode, and speak commands such as "make bigger"/"make smaller" to increase/decrease the size of the shapes or "show yellow stars" to change the color and type of falling shapes.

Demo

How does it work?App.xamlDeclaration of application level resources.App.xaml.csInteraction logic behind app.xaml.FallingShapes.csShape rendering, physics, and hit-testing logic.MainWindow.xamlDeclaration of layout within main application window.MainWindow.xaml.csNUI initialization, player skeleton tracking, and main game logic.Recognizer.csSpeech verb definition and speech event recognition.

Step 1 (Register for Events)Kinect.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor )

Kinect.SkeletonFrameReady += new EventHandler(SkeletonsReady);

speechRecognizer = SpeechRecognizer.Create(); speechRecognizer.Start(new KinectAudioSource()); speechRecognizer.SaidSomething += new EventHandler(recognizer_SaidSomething);

Process EventsProcess skeleton dataMainWindow.xaml.csMethod: void SkeletonsReady(object sender, SkeletonFrameReadyEventArgs e)Update the joint data positions

Process speech MainWindow.xaml.csMethod: void recognizer_SaidSomething(object sender, speechRecognizer.SaidSomethingEventArgs e)Match it with the speech vocabulary and get the command

Translate the speech command to a list of operations for the falling objectsFor ex. the speech commands reset will get translated to:SetPolies(PolyType.All);SetDropRate(dropRate);SetGravity(dropGravity);SetSize(dropSize);SetShapesColor(Color.FromRgb(0, 0, 0), true);

How do you find out a hit?Any guess?How do you find out a hit?Convert joints data into bones/segments data (a bone is a segment that connects two joints)

Now, we can maintain a dictionary of {bone, }

Update the segment's position and compute a smoothed velocity for the circle or the endpoints of the segment based on the time it took to move from the last position to the current one. The velocity is in pixels per second.

How do you find out a hit?Lets seeFailingShapes.cs class FallingThingspublic bool Hit(Segment seg, ref Point ptHitCenter, ref double lineHitLocation)if hit, the center point on the segment being hit is returned, along with the spot on the line from 0 to 1 if a line segment was hit.

Bouncing off after a hitLets seeFailingShapes.cs class FallingThingspublic void BounceOff(double x1, double y1, double otherSize, double fXv, double fYv)

The useful code that you can reuseSpeechRecognizer.csWe have already covered it in lab3Finding out a hit between the skeleton and an objectThe bouncing off effect.