Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want stabilize mouse-pointer when I use kinect. I did the set of cursor, using smooth and sensitivity, but the cursor jumps mainly in margins of screen. Somebody can help me?

The code that I have for set cursor is:

// set cursor position
MouseControl.SetCursorPos(
// X coordinate
(int)(curPos.X + (x * mouseSensitivity * screenWidth - curPos.X) * smoothing),
// Y coordinate
(int)(curPos.Y + ((y + 0.25f) * mouseSensitivity * screenHeight - curPos.Y) * smoothing)
);


What I have tried:

add thread.sleep() but didn't work.
Posted
Updated 6-Apr-17 6:30am

Why would putting the thread to sleep "smooth" out the mouse pointer? All that does is make your app completely unresponsive.

You're "smoothing", if that's what you want to call that code, the position of the mouse pointer isn't the correct way to go about this.

What you should be doing is called "digital signal processing". You should be "smoothing" your input signal, the position of the users hand (I'm guessing at what you're using) and doing it over time, say the last 5 to 10 position frames you captured.

There are plenty of examples on the web. All you have to do is Google for "Kinect use hand as mouse cursor[^]".
 
Share this answer
 
Thanks Dave.
I already searched, but didn't found nothing, to help me. Can you help me?
 
Share this answer
 
Comments
Richard Deeming 6-Apr-17 13:16pm    
If you want to reply to a solution, click the "Have a Question or Comment?" button under the solution.

DO NOT post your reply as a new "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900