Mari
unread,May 29, 2012, 5:51:08 AM5/29/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to OpenNI
If you have everything necessary installed (which it sounds like you
have -- if not, take a look at the ZigFu package, which installs
everything you need very easily), then it's really just a matter of
including the .Net wrapper into your project. The confusion is
understandable, though, as there is no clear guide, really.
Find the OpenNI.net.dll file in the OpenNI folder, and either copy it
to your project folder or simply leave it there, but remember where
you found it. Then you go to Solution Explorer in Visual Studio and
add it as a reference by right clicking -> Add Reference, and find the
file in the Browse tab (I don't have it in front of me right now, but
I think this should work). Make sure your code has "using OpenNI;" up
top, if not then you have to add it.
The second file you must keep in mind is the OpenNI config file, which
is called SamplesConfig.xml and can be found in the OpenNI folder as
well. The config file can be used to decide whether you want a mirror
image or not, and to decide things like whether you want to use a
depth map, IR map, change the frame rate and resolution and so on.
To get started, you can try something like this (this is not working
code, but it should give you a hint of how to go about it and what the
code might look like):
readonly string SAMPLE_XML_FILE = "path_to/SamplesConfig.xml";
Context context;
DepthGenerator depthGenerator;
UserGenerator userGenerator;
context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);
depthGenerator = context.FindExistingNode(NodeType.Depth) as
DepthGenerator;
userGenerator = new UserGenerator(context);
userGenerator.NewUser += userGenerator_NewUser; // New user event
userGenerator.LostUser += userGenerator_LostUser; // Lost user event
userGenerator.StartGenerating();
context.WaitOneUpdateAll(depthGenerator);
void userGenerator_NewUser(object sender, NewUserEventArgs e) {
// Do something when a new user is discovered
}
Hope that helps a little bit. Like TcBoY says, getting started with
the Kinect SDK should be easier as there is simpler documentation
available and you don't have to sort through what is outdated and what
is not to the same degree as you have to with OpenNI, but it depends
on what you want to do, I guess. We have used OpenNI with C# to make a
game, and it worked out fine, you just have to dig a bit more to find
out what to do.