How to adjust Kinect sensor automatically based on user positions ?

This is an interesting question. Can we really adjust sensor based on user positions ?  The answer will be YES, We can. But limitation is only either in horizontal or vertical direction.   Kinect device has a tiny motor which is used to change the camera and sensor’s angles, to get the correct position of the human  skeleton. The motor can be tilted vertically up to 27 degrees, which means that the Kinect sensor’s angles can be shifted upwards or downwards by 27 degrees.

The Skeleton class has a property named ClippedEdges, which is of type FrameEdges, which says which portion/ parts of the skeleton are out of the Kinect’s view. FrameEdges is a Flag enumeration with the following flags:
• None
• Right
• Left
• Top
• Bottom

None means, Kinect can view the complete skeleton and there is no  area which is cutting out from Kinect view area. For other values, they indicates which part of the body / join is cutting out.  Based on this value you can provide live feedback to users on standing properly and for top and bottom, you can change the sensor elevation angle ( by setting the ElevationAngle property) .

For example, ClippedEdgesUpdates() method from the SkeletonFrameReady event handler, where you can pass the individual skeleton frame to check if any body area is getting cut off.

private void ClippedEdgesUpdates(Skeleton skeleton)
{
switch (skeleton.ClippedEdges)
{
case FrameEdges.Bottom:
SkeletonCutArea(FrameEdges.Bottom); // Change the sensor elevation angle
break;
case FrameEdges.Left:
SkeletonCutArea(FrameEdges.Left);
break;
case FrameEdges.None:
SkeletonCutArea(FrameEdges.None);
break;
case FrameEdges.Right:
SkeletonCutArea(FrameEdges.Right);
break;
case FrameEdges.Top:
SkeletonCutArea(FrameEdges.Top);  // Change sensor elevation angle.
break;
default:
break;
}
}

The ClippedEdgesUpdates() method accepts the tracked skeleton and checks the ClippedEdges property if any of the FrameEdges flags have been set. Depending on the flag values, call the SkeletonCutArea() method, where you can write your own implementation to notify the user for what action to be taken.  For Bottom and Top, you can set the sensor elevation angle  to adjust the sensor

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

One Comment to “How to adjust Kinect sensor automatically based on user positions ?”

Comments are closed.