Share via


KinectInteraction Controls

Kinect for Windows 1.7, 1.8

KinectInteraction Controls

KinectRegion

Construction of a C#/WPF application starts with the KinectRegion control.

The KinectRegion provides a canvas for other KinectInteraction Controls, such as KinectTileButton and KinectScrollViewer controls.

The KinectRegion acts as a container and coordinator for other KinectInteraction Controls. A KinectRegion is associated with a particular Kinect for Windows sensor.

A given application may define multiple KinectRegions, but active KinectRegions may not be structurally nested while both are active. KinectRegions may overlap.

As shown in the Controls Basics - WPF sample and as can be seen from the list of methods available on the KinectRegion, the KinectRegion handles events that are provided by the lower layers of the KinectInteraction architecture. These events detail all state changes of the tracked hand. Other events detail when the tracked hand is recognized as entering or leaving a given KinectRegion or Kinect Control.

Binding a KinectRegion to a Kinect Sensor

For a KinectRegion to use a Kinect sensor, the sensor that you associate to a KinectRegion must have the depth stream enabled at 640x480 resolution, and it must have the skeleton stream enabled. Interaction will not work properly if either of these streams are disabled or in a different mode. Near mode is supported.

If the application wishes to stop Kinect interaction within the KinectRegion, it should set the KinectSensor property on the KinectRegion to null.

KinectCursor

As mentioned in KinectInteraction Concepts, the KinectCursor is the representation of the user's hand as determined by the recognizer (that is, a visual representation of the KinectHandPointer). The KinectCursor may be moved by the user across the screen. The KinectRegion works with the KinectCursor to determine which Kinect Control the user is currently interacting with.

The KinectCursor needs to be associated with a cursor visualizer, which places the cursor in its correct position within the region. There is one visualizer per region, and a cursor visualizer is automatically created as part of region creation.

The KinectCursor has a number of states, depending on what the user is doing with their hand as they interact with the Kinect Sensor. These are taken from the underlying KinectHandPointer. Some of these states are:

  • Tracked-- The hand is being tracked by the Kinect sensor, but is down.
  • Active-- The user has their hand up, but outside of the interactive volume.
  • Interactive-- The user is comfortably interacting with the screen.
  • Grip-- The KinectCursor is associated with a given KinectInteraction Control and the hand is recognized as gripping the control.
  • Press-- The KinectCursor is associated with a given KinectInteraction Control and the hand is recognized as pressing the control.

Figure 1.  2d Representation of the Physical Interaction Zone and Hand State

Dn188674.k4w_PhIZ_Active(en-us,IEB.10).png

Note that the KinectCursor does not actually have to be visible; its visibility can be turned on or off.

Also note that it is possible to have multiple KinectCursors associated with a given region.

Note

It is possible, in advanced scenarios, to write your own cursor visualizer and associate it with a given region. However, in this case, you must be careful to size the visualizer to the KinectRegion you want to use, or the cursor will not appear in the correct place in the region.

The KinectItems Control

The KinectItems Control creates KinectButtons for data bound items and wraps them in a KinectScrollViewer.

The KinectTileButton

The KinectTileButton control provides a modern-style rectangular button, with optional label text and optional alternate graphics for various interaction states. (For example, the button may be drawn differently when it is pressed.)

The KinectCircleButton

The KinectCirclebutton control provides a modern-style circular button, with optional label text and optional alternate graphics for various interaction states. (For example, the button may be drawn differently when it is pressed).

The KinectScrollViewer Control

The KinectScrollViewer control provides a scroll box capability, which can be scrolled by gripping an element in the scroll box and sliding the hand towards one side or the other. This control is a container control, and can thus contain other Kinect Control elements such as tile buttons.

To see how this works in practice, run the Controls Basics - WPF sample.

The UserViewer Control

The UserViewer control provides a view of what the Kinect interaction layer is looking at. This can be seen in the Controls Basics - WPF sample.