# how to turn kinect coordinates into relative mouse position?

• ### Question

• I am working on a project and need the Kinects coordinates relative in order for my code to properly execute (It needs to be in byte format with valid values of 1-255). How can I get the relative position of where my hand from the Kinect was last at? (similar to relative mouse coordinates) For easier understanding I am using a slightly modified version of the Kinect mouse code from here for usage with multiple mouse users: http://kinectmouse.codeplex.com except I need the coordinates sent to the mouse relative and in byte format.

Here's my project page with the code:

http://kinectmultipoint.codeplex.com

P.S. if you want to incorporate this into your project please note that even though its for educational usage you can later change out the code to include your own custom mouse emulation driver if you wish.  It has a limitation of 20 users right now but can support 40 users.

Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr

• Edited by Wednesday, February 27, 2013 4:38 PM
Wednesday, February 27, 2013 3:58 PM

• I am not familiar with the code, but you should be tracking the previous location(s). From that, calculate the vector between current and previous point. Convert to a unit vector, value between float 0.0 - 1.0. multiply that by 255 and add 1.

Monday, March 18, 2013 9:58 PM

### All replies

• I am not familiar with the code, but you should be tracking the previous location(s). From that, calculate the vector between current and previous point. Convert to a unit vector, value between float 0.0 - 1.0. multiply that by 255 and add 1.

Monday, March 18, 2013 9:58 PM
• I am not familiar with the code, but you should be tracking the previous location(s). From that, calculate the vector between current and previous point. Convert to a unit vector, value between float 0.0 - 1.0. multiply that by 255 and add 1.

You wouldn't have any simple source code to help me out with that do you? So by vector you mean the position data of the user/person recoginized by the kinect yes? Person 1 will have different position data from say person 2.  I just have not heard of the unit vector but have used a vector before in xna projects.

Note: Carmine byte range is limited to from 1 to 255 for the part Iam trying to work on.

Edit: would vectorname.normalize work to convert the vector to a unit vector?

Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr

• Edited by Monday, March 18, 2013 10:48 PM
Monday, March 18, 2013 10:43 PM
• Please take a look at the Kinect Interactions work in v1.7 of the SDK/Toolkit.

The interactions demonstrated in ControlsBasics-WPF and InteractionGallery-WPF utilize our Physical interaction zone (or PhIZ) to map from a persons hand and body to an appropriate X, Y and Z (PressExtent) for uses such as driving interaction via a cursor.

Thanks, Rob Relyea
Kinect team
@rrelyea

Tuesday, March 19, 2013 2:18 AM
• Please take a look at the Kinect Interactions work in v1.7 of the SDK/Toolkit.

The interactions demonstrated in ControlsBasics-WPF and InteractionGallery-WPF utilize our Physical interaction zone (or PhIZ) to map from a persons hand and body to an appropriate X, Y and Z (PressExtent) for uses such as driving interaction via a cursor.

Thanks, Rob Relyea
Kinect team
@rrelyea

Thanks rob I will check it out though Iam trying to do multiple Kinect users not just one. Iam looking to get the relative position because i pass the x,y coordinates in binary for the emulated mouse devices. It weird but it's how the low level emulator iam dealing with handles the data.  tommorow I will post a piece of the code but it is a simple hand joint being tracked with x,y coordinates used. Just for reference does the v1.7 SDK have the ability to handle more then 2 skeletons  to be tracked at a time if I have the power to do so?

Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr

Tuesday, March 19, 2013 2:39 AM
• After reviewing the answers, carmines answer sounds the most logical and best explained but until I check out the sample rob I do not know. If this true you both should receive the answer (I need the relative position though).  Thank you both.

Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr

• Edited by Sunday, March 24, 2013 10:19 PM
Sunday, March 24, 2013 10:06 PM
• I am not familiar with the code, but you should be tracking the previous location(s). From that, calculate the vector between current and previous point. Convert to a unit vector, value between float 0.0 - 1.0. multiply that by 255 and add 1.

Carmine I tested with a random integer value bigger then 255 and your idea works but I have yet to test with kinect application. I have tested though seperately in another wpf application and so far it works as expected.

Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr

• Edited by Wednesday, April 3, 2013 3:23 PM
Wednesday, April 3, 2013 3:21 PM