Kinect Help document translation of two gestures

Source: Internet
Author: User
Tags case statement

use or create gestures

There are two ways to add gesture recognition to your unity project. The first: Find the Kinectmanager component, which is attached to the Maincamera in the example. There are two list properties in the component "Player1 gestures" (gestures from player 1) "Player2 gestures" (gestures from player2). These two lists have gestures that can be detected during the entire game run. The second is to implement user-specific gestures in a programmatic way. You need to implement the Kinectgestures.gesturelistenerinterface interface to add gestures or handle any specified gestures. Here's an example: Kinectscripts/extras/simplegesturelistener. The simple description is as follows:

Userdetected () for initiating gesture detection;

Userlost () is used to clean up variables or resource usage. You do not need to remove the gestures added in userdetected (). These will be cleared automatically before calling Userlost ().

Gestureinprogress () is called when a gesture starts but has not been terminated or canceled.

Gesturecompleted () is called at the end of a gesture. You can add your own code here to handle gestures

Gesturecancelled () call when the gesture is canceled

Identify gestures

The following gestures can be smoothly identified:

raiserighthand/raiselefthand– the left or right hand over the shoulder and hold it for at least one second

psi– hands over their shoulders and hold them for at least a second.

stop– hands drooping.

wave– the left or right hand to swing back and forth

swipeleft– the right hand to the left.

swiperight– left hand to the right.

swipeup/swipedown– left or right hand up/down

click– left or right hand in the appropriate position for at least 2.5 seconds.

righthandcursor/lefthandcursor– false gestures used to make the cursor move with the hand

zoomout– elbow downward, left and right palms together (seeking Buddha gestures), and then slowly separated.

zoomin– elbow down, two palms together at least 0.7 meters, then slowly close together

wheel– English Original description is not clear, is the zoomout/in gesture, but in the time of movement is before and after rather than around.

jump– at least 10 centimeters in hip joint center in 1.5 seconds

Squat-in 1.5 seconds the hip center drops at least 10 centimeters

push– to push the left or right hand outward within 1.5 seconds.

Pull-the left or right hand to the lira within 1.5 seconds

Add your gestures

Here's a look at the process of adding gesture recognition to Kinect, you need to have a basic knowledge of C # and learn a little bit about the basic workflow of the Kinect sensor. In the Kinect's coordinate system, it provides the three-dimensional coordinates of the tracked object, measured in meters.

To add a user-defined recognition gesture, first you need to open the Assets/kinectscripts/kinectgestures.cs script file and then:

1. Find the enumeration of gestures and add the name of the gesture you want to define after this enumeration

2. Find the Checkforgesture () function, here is a very long switch () statement, each of the gestures enumeration of gestures need to be handled here using case statements. Therefore, you need to add a case statement here to handle your newly added gestures.

3, of course, you can look at Raiselefthand, Raiserighthand, swipeleft or swiperight how these are handled as examples of learning.

4. As you can see, there is also a switch statement inside each handle gesture to detect and change the current state of the gesture. Each State is represented by a number (0,1,2,3 ...), and its state changes according to the data stored in the GESTUREDATA structure. This data structure body is created for each gesture that needs to be recognized in the scene.

5, the initial state of a gesture is 0, in this state, the program needs to identify whether the gesture started. To do this, it needs to check and store the position of the joint, usually the left or the left hand. If the position of a joint matches the beginning of a gesture, the state value of the gesture is added one. In the next state, it needs to check if the joint has reached the desired position (or the desired distance is moved). This check needs to be done in a certain amount of time and we usually set it to 1-1.5 seconds.

6, if the joint is detected in the set time to achieve the desired position (or move the ideal distance), then the gesture is considered to be successful, otherwise, as the gesture is canceled, the status will be set to 0, and start again.

Kinect Help document translation of two gestures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.