Programming a Kinect Bounding Box

Sign in to queue

Description

Getting the Kinect to respond to some people, in a specific area, but not others... a Bounding Box. Mike Hodnick, not only shows us how, but provides a great 16 minute tutorial screencast to talk us through it too.

Programming a Kinect Bounding Box

In my last post and screen cast I showed how to implement the Kinect runtime as part of a Model-View-ViewModel (MVVM) pattern. In this post and accompanying screen cast I will build on that application by adding a "bounding box" feature that limits control of the application depending on where the user is standing.

Imagine a scenario where your Kinect-based application is running in an area where there is a lot of "noisy" user traffic in the background. It could be in a lobby, a trade show booth, a career fair, or a point of sale counter to name just a few scenarios. You obviously don't want users in the background to control your application. You only want users who want to control your application to actually control it.

There is more than one way to solve this problem. Perhaps the easiest way is to limit where a user is allowed to stand in order to control and interact with the application. I call this method The Bounding Box method. This method works great if you have multiple instances of the application running side by side and if you don't want one instance to allow control by the user of the second instance.

Project Information URL: http://kindohm.com/2011/08/02/KinectBoundingBox.html

Project Source URL: https://github.com/kindohm/kinect-bounding-box

image

double minDistanceFromCamera;
public double MinDistanceFromCamera
{
    get { return this.minDistanceFromCamera; }
    set
    {
        this.minDistanceFromCamera = value;
        this.OnPropertyChanged("MinDistanceFromCamera");
    }
}

double boundsWidth;
public double BoundsWidth
{
    get { return this.boundsWidth; }
    set
    {
        this.boundsWidth = value;
        this.OnPropertyChanged("BoundsWidth");
    }
}

double boundsDepth;
public double BoundsDepth
{
    get { return this.boundsDepth; }
    set
    {
        this.boundsDepth = value;
        this.OnPropertyChanged("BoundsDepth");
    }
}

bool userIsInRange;
public bool UserIsInRange
{
    get { return this.userIsInRange; }
    set
    {
        this.userIsInRange = value;
        this.OnPropertyChanged("UserIsInRange");
    }
}

bool GetUserIsInRange(
    Microsoft.Research.Kinect.Nui.Vector torsoPosition)
{
    return torsoPosition.Z > this.MinDistanceFromCamera &
        torsoPosition.Z < (this.MinDistanceFromCamera + this.BoundsDepth)
        & torsoPosition.X > -this.BoundsWidth / 2 &
        torsoPosition.X < this.BoundsWidth / 2;
}

Contact Information:

The Discussion

  • User profile image
    Alexandra Lawrenz

    The bounding box is such a cool idea. Being able to use Kinect in crowded areas, which will limit control of the application, makes it seem a lot more appealing. How do you determine the necessary area requirements for the bounding box? http://bit.ly/nlBTmF

Add Your 2 Cents