Kinect Earth Move
- Posted: Jul 04, 2011 at 6:00 AM
- 10,101 Views
Today's project was first seen on during the Kinect for Windows SDK launch on June 17, 2011. It's a simple demo, but that's the thing. It shows how much you can do quickly, with just a little code.
KinectEarthMove, which use color image and skeleton from Kinect, needs Kinect for Windows SDK beta and was demonstrated on Kinect for Windows SDK beta launch at Channel 9 on June 17 2011.
User in front of Kinect can rotate, translate and scale the earth between his hands.
KinectEarthMove is sample project for Kinect for Windows SDK beta.
Project Information URL: http://kinectearthmove.codeplex.com/
Project Download URL: http://kinectearthmove.codeplex.com/releases/view/68914
Project Source URL: http://kinectearthmove.codeplex.com/releases/view/68914
private void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
SkeletonFrame skeletonFrame = e.SkeletonFrame;
Vector shoulderC = new Vector();
Vector handR = new Vector();
Vector handL = new Vector();
Vector shoulderR = new Vector();
Vector shoulderL = new Vector();
// find positions of shoulders and hands
foreach (SkeletonData data in skeletonFrame.Skeletons)
{
if (SkeletonTrackingState.Tracked == data.TrackingState)
{
JointsCollection j = data.Joints;
shoulderC = j[JointID.ShoulderCenter].Position;
handL = j[JointID.HandLeft].Position;
handR = j[JointID.HandRight].Position;
shoulderL = j[JointID.ShoulderLeft].Position;
shoulderR = j[JointID.ShoulderRight].Position;
break;
}
}
// translate
// Find the center of both hands
Vector3D pos = new Vector3D((handR.X + handL.X) / 2.0, (handR.Y + handL.Y) / 2.0, (handR.Z + handL.Z) / 2.0);
// move to the center of both hand
earthTransform.Translate = new Vector3D(pos.X*tfactor, pos.Y*tfactor, pos.Z);
// scale
// find the vector from left hand to right hand
Vector3D hand = new Vector3D(handR.X - handL.X, handR.Y - handL.Y, handR.Z - handL.Z);
// find the vector from left shoulder to right shoulder
Vector3D shoulder = new Vector3D(shoulderR.X - shoulderL.X, shoulderR.Y - shoulderL.Y, shoulderR.Z - shoulderL.Z);
// scale the earth from the difference of lengths(squared) of inter-shoulders and inter-hands
// if same length scale to 0.8. longer inter-hand , bigger scale
earthTransform.Scale= hand.LengthSquared - shoulder.LengthSquared + 0.8;
// rotataion
// get the angle and axis of inter-hands vector to rotate the earth
hand.Normalize();
earthTransform.Angle = Vector3D.AngleBetween(new Vector3D(1, 0, 0), hand);
earthTransform.Axis = Vector3D.CrossProduct(new Vector3D(1, 0, 0), hand);
}
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?