I would like to use a gesture, so the kinect can select the person with the gesture as the main player. After this he can control the PC. Selecting the person and giving them control is done. Now i have to implement a gesture, but i dont know how to start.
Can anyone help me?
I guess that is what you want (if you like to recognize gestures by yourself):
MS explains how to recognize a wave gesture with a full code example here:
http://blogs.msdn.com/b/mcsuksoldev/archive/2011/08/08/writing-a-gesture-service-with-the-kinect-for-windows-sdk.aspx
By now there are also some gesture recognizer toolkits available.
See this for example:
http://kinecttoolbox.codeplex.com/
You can also surf on http://channel9.msdn.com for similar projects, like that one:
http://channel9.msdn.com/coding4fun/kinect/Gestures-and-Tools-for-Kinect-and-matching-Toolkit-too
Did you get as far that you have the skeleton?
The easiest is to check how many times the hand changed velocity direction
+x --> -X means it went left and is now coming back right, you can do a distance check between these points to determine if the wave gesture is obvious enough (omits very tiny waves/jitter)
Take some reference for hand have - say elbow - and store it into a variable and take some reference distance for the hand move such that whenever the hand moves on both sides beyond the reference distance on both sides, calculate the number of waves with the waves you require in your program. If both match select that person for your program
Related
I've started learning c# and vb.net and have a project related to tracking a moving object on the screen to help me learn some basics.
In essence, I will have a ball on the screen which moves from left to right (only horizontally), and when it reaches a certain point (e.g. 250 pixels from the "mid" point either side) I need to know this, and click an on-screen counter to increase a value (or decrease depending on left or right) and reset the ball to the centre (note that the ball speed will vary from incredible slow to an instant "jump").
I've been asked to look into c# and vb and decide which is best, then use it to create the program. As a complete newbie in both of these, does anyone have a recommendation and a starting point please?
My background is Javascript, HTML and very basic Java.
Thanks!
Not too sure what you define as a "Starting Point" do you mean like different C# libs to use etc. If all you are trying to do is move a ball from left to right basically and count the difference it would be so simple to do in C# XNA.
You can also do it in windows forms too which I really thing shouldn't be too hard at all. Obviously you would create the velocity formulas yourself I don't believe that's what you're asking.
One way to get the screen size in windows forms is:
public Rectangle GetScreen()
{
return Screen.FromControl(this).Bounds;
}
This will return a rectangle with a width and height that you can call, divide both values by 2 and it will give you the center of the screen. Then just add a method that is called every frame to check the balls value from the middle of the screen.
From what I've read I understand what you want to do, but I'm unsure if you just want a windows form or if you'd prefer to use a small game engine like XNA etc.
Either way best of luck and let me know :)
I'm using an Oculus Rift with Unity, and am attempting to allow the user to zero-out the orientation of their device when they push a key. The idea is that the camera is frozen looking in a particular direction, and when the user begins the game, whatever direction they're looking in is bound to that camera orientation. I found this forum post, but it only says to use SetOrientationOffset, but doesn't provide code.
I've tried both of the following, independent and together:
OVRDevice.ResetOrientation ();
cameraController.SetOrientationOffset (Quaternion.identity);
However, neither seems to have an effect. I've even tried passing other quaternions into SetOrientationOffset, but that seemed to have no effect.
Does anyone have a working code example?
If different quaternions make no difference then you probably have a game object set in the FollowOrientation variable. If you clear that then passing in different quaternions should have an effect. Alternatively you can rotate the thing you've set in FollowOrientation. Then you need to find the correct orientation to start in. Probably the rotation of the frozen camera is what you need.
I am making an app with c# for my windows phone 7.
I want to use compass for showing me the qibla direction (or which way I want).
how can I make it? I can calculate the degrees of qibla direction from my location with lang and latitute.(for example result is 150 degress east of north)
but then, I cannot draw the direction line for it.it shows north, not my way which I want.
so now I am using this code for drawing line:
magneticLine.X2 = magneticLine.X1 - (200 * Math.Sin(MathHelper.ToRadians((float)compassReading.MagneticHeading)));
magneticLine.Y2 = magneticLine.Y1 - (200 * Math.Cos(MathHelper.ToRadians((float)compassReading.MagneticHeading)));
can you help me about how I can make this. thanks.
The way you have it built currently you are merely using the center of the screen as the point of origin and then rendering a line that is always 200 pixels in length. You need to adjust/tamper with the degree reading prior to drawing your line (that's why it's not pointing in the correct direction for you).
Also, once you have something you think is correct, use the Windows Phone emulator to plot GPS points around Kaaba in Mecca (i.e. Make a circle of points around the Kaaba and then run a simulation). That will allow you to see if your solution will work for individuals in a 360* radius correctly.
Furthermore, this toolkit on Augmented Reality may help you as it does some of the math for you when calculating the direction based on your GPS location: http://gart.codeplex.com/
I hope this helps. If you are still stuck after the above reading, I can code it out for you so you have a better understanding.
Lastly, scope this out: http://www.jeffblankenburg.com/2011/11/04/31-days-of-mango-day-4-compass/
It's a tutorial on how to make a compass with working source code to download at the bottom of the article. Good luck!
I am developing a card game using WPF and since i do not have any knowledge about animations i would like to know if someone could help me in how to write an animation to simulate a Card ( Image ) been played over a table.
At the bottom and top of my game table i have my cards on vertical position.
At the right and left my cards are on horizontal position.
What i really want is give an impression that a human is selecting and throwing the card.
Since your question is pretty open-ended, I'll give you an open-ended start...
Look into Storyboards, and how to use the same to modify the RenderTransform of your Card UserControl.
Your first step should really just be animating your card's position from its initial spot to the center of the table. As an additional hint (which will come in handy after you've learned about Storyboards), your DoubleAnimation.From property does not need to be specified. You just need to specify the DoubleAnimation.To property.
I see questions like this all the time on SO, and it really does give the impression of "I haven't tried, and I have not read anything". You already have your cards on the table (so to speak), and the question is, make it look like a human did it.
There are a variety of ways, some cheap and simple, some more complex and involved. You won't know the answer until you try.
For example, perhaps you want a card to go from one position to another (optionally flipping). You have varying degrees of difficulty here:
Move the card to the position, as is. Cheap and easy. You could even use the distance between the source and the target to determine the speed to have some kind of residual momentum.
Cards are at different angles. How do we rotate? XNA makes this pretty simple, have you looked up on XNA and general rendering? Or do you want to this purely using WPF?
Does the move involve showing the card face-up, or not? Will there be an animation involved? Are you happy with just the face changing or do you want to see an actual "flip"? If it's the latter than some kind of a plane in XNA using 3D might be better, at least then you can have two faces with two different textures.
What I am saying is, and why this is an answer as opposed to a comment, is that you have given no indication of anything that might be considered trying to solve the problem. You seem like you've got halfway there, you've already got cards rendered on the screen. But to ask "Make it look like a human put a card in"...? Well, sorry... it's not that simple. You can make this task as easy or had as you wish.
Like mentioned what is the best way of detecting in which direction the user is dragging horizontally. I'm trying to create a camera class that responds to this gesture but am having problems determining which direction they are dragging. Any suggestions are appreciated.
Admittedly I haven't tested this, but the documentation suggests that you should check the value of GestureSample.Delta.X, which should be negative for a left movement, and positive for a rightwards one.
Because the delta is only for that particular gesture sample (not the overall gesture), you may need to accumulate it, and only trigger your drag action if the accumulated value is above some threshold (possibly upon receiving a DragComplete).