Kinect Reception

If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource

The Idea: TV Screen in the Reception, When nothing happens (no one is in the reception) we can display videos on the screen but when someone enters the frame, show him the Kinect Image, and if the user is doing something funny, capture his image and save it.

The question is how can I know if the person is doing something funny?

For that, I've created Image AuthenticManager that contains a set of rules defining what positions or combinations are funny.

For example: If right hand position is higher than head position, then add 2 points, if the left foot position is crossing the right foot, then add an additional 2 points, etc.When the user reaches the goal, we decide then to take his picture.

Before jumping to coding, let's talk about the application flow:The main window is controlled by two Timers and the AuthenticManager:

SeriousTimer set to 10 secs and it starts Ticking as the Kinect Skeleton Event is first fired (this event will only work when the Kinect identifies a full person skeleton).Inside the SkeletonFrameReady, we also have integer called _fpsCount that increases itself by 1 each time the SkeletonFrameReady is called after starting the SeriousTimer, this will help us to make sure the user is standing in front of the Kinect and not just walk by him.

Now how can the _fbsCount tell me that? ll we need to do is multiply the SeriousTimer seconds interval by the Minimum Fps (for example 10) and the _fpsCount should be bigger if the user stands in front of the Kinect.

In this case, the Timer will stop the Video feed and will display the Kinect Image.

IdleTimer by default is set to 30 seconds and each time the SkeletonFrameReady method is fired, we restart the IdleTimer.

So if there are no events for SkeletonFrameReady, the IdleTimer will return the Video feed.

JointID - AuthenticManager works with RuleObject that contains JointID Source and JointID Target (More about Joints - Kinect - Getting Started - Become The Incredible Hulk).AuthenticManager is the heart of Kinect Reception application, this class will check if the user position is funny by your own rules.

What is Joint?

The data is provided from the Kinect application code as a set of points, called skeleton positions, that compose a skeleton structure.

Vector - For Source and Target Joints, you also have to define the Vector to check X or Y against one another.

Operator - Do you expect the Source Vector to be Bigger or Smaller than the Target Vector?

Score - If the rule is true, what is the score for the rule.

Background

Since Microsoft has released the Kinect.NET SDK, I wrote many articles on that subject:

I think Kinect is very cool and I'm searching for more projects and good ideas for Kinect. A couple of days ago, I talked with my friend Guy Burstein and he came up with an idea for Kinect application, he said what if people will enter the Microsoft Israel reception and instead of video screen showing commercials, let's add something interesting with Kinect.

Using the Code

Using Kinect events, I can see when user enters the frame, using two timers I can check if the user is just passing by or is standing in front of the camera.

The below image describes the application flow, at the beginning the application will show random videos, when the Kinect Skeleton Event will raise then the Serious Timer will begin ticking, each tick based on the FPS rate will be aggregated to variable called NumTicks, when the Serious Timer completes we check if NumTicks is big enough based on the FPS, if so then we'll start the Idle Timer and switch to Kinect Image.

Idle Timer - Each time the Kinect Skeleton Event is raised, the Idle Timer will be restart, so if there is no one in front of the Kinect camera, the Idle Timer will switch back to Videos.

As you can see from the images below (or Full Video), when I moved my hands or legs, the Score Bar has changed based on the rules you defined:

You reached the Goal!!!

The entire application works with 4 managers:

Kinect Manager

Configuration Manager

Video Manager

Authentic Manager

Kinect Manager

I've shown how to get started with Kinect many times in my previous posts, but for this application, I've created a singleton class to handle everything related to the Kinect settings, from restarting the Kinect RunTime object to changing the camera angle.

The Video Manager has two specific types of Videos to play and the main Videos folders to pick random video each time.

Specific? When the user enters the Kinect Range, you can choose to play a specific video just before the Kinect Image will appear, and when the user leaves Kinect Range, you can choose to play the Out Video.

Define the type of video you want to play. If you ask for out video and there isn't one, return null - Stop Video and start showing Kinect Image. If you ask for in video and there isn't one, then return random video.

Shai Raiten is VS ALM MVP, currently working for Sela Group as a ALM senior consultant and trainer specializes in Microsoft technologies especially Team System and .NET technology. He is currently consulting in various enterprises in Israel, planning and analysis Load and performance problems using Team System, building Team System customizations and adjusts ALM processes for enterprises. Shai is known as one of the top Team System experts in Israel. He conducts lectures and workshops for developers\QA and enterprises who want to specialize in Team System.