Unity3D + Leap Motion: Gesture replay and recognition from web - c#

He there,
I'm currently working on a serious game for a school project. In short, this game is supposed to help people with differtent types of hand arthritis (and related diseases). The general idea is that the game will help the patiënt with moving their hands and fingers to keep them as healthy as possible.
The fact is, that every patiënt is different, so each patiënt has different "exercises" they have to perform. We have thought about this problem and we think the best way to handle this, is to record exercises for each patiënt.
We came up with the following idea. We created a web portal for doctors and physiotherapists. In here, they are able to "create" patiënt files. Each patiënt file has different information about that particular patiënt. Next to that, the doctor is able te record different exercises using the leap motion. I have used the jestPlay project to achieve this. So far, the doctor/therapist is able to record an exercise for a particular patiënt and store this exercise as a .json file on the server.
In addition to this, another part of the time is building a game in the Unity3D engine (C#). In this game, the player uses spells to clear the game. These spells are supposed to be the particular exercises the doctor recorded in the web application. When the patiënt logs in on the game, the .json file of the exercises will be send to the Unity3D engine. So far, so good.
Once the .json file is in Unity, I use a json parser to put it into an object(array). The data should be translated to a movement in leap motion (a replay so to speak). Once the particular patiënt does the movement/exercise the doctor initially recorded, then the spell is should complete.
Now, I have the following issues and I don't really know where to start to tackle this. I really hope there is someone that has dealed with something like this before and is able/willing to help me out with it.
-How do I translate the data from the webapplication (see http://www.yorickkeijzer.nl/cotf/application/exercise.json2 for an example) to a leap motion replay / exercise / movement in Unity?
-How do I make Unity recognize the diffent movements/exercises (so compare the .json data from the web application with the real time leap motion data in unity)?
I hope, I have explained it clear enough. If you have any questions, please don't hesitate to ask them.
Thanks a lot!

Reposting this response from: https://community.leapmotion.com/t/unity3d-gesture-replay-and-recognition-from-web/209/2
documents sending information between the javascript/web Leap client and the unity web engine.
In summary: you can use the Javascript Leap client to detect frame data and send it (or a subset of that data) to the web player using Unity's browser API. Leap web player does not directly have access to the frame data stream because of browser sandboxing, which is why we have to give it an indirect feed of frame data.
I would not recommend sending every piece of information in the frame to the web player; if you know what information you want -- finger tips, palm location, gestures -- send that information to Unity in a custom message JSON block.
If you are sending in JSON keep in mind you'll be sending strings of JSON; to pick apart that data you would use the JSONObject code found in the wiki and referenced in that article.
There are Gists of the basic files used by me in my implementation.
Dave Edelhart
Senior Web Developer
Leap Motion
Other links:
Leap JavaScript API documentation: js.leapmotion.com

Related

How do I create a live video recording program on Visual Studio using c#?

I am currently doing a project for school and desperately in need of help.
The main gist of the project:
I am using 3 Bosch Dinion IP Cameras to film students during a lecture. I have to create a program on Visual Studio that enables the lecturer to view all 3 cameras on one screen, able to record all 3 footages and then save them in a database afterwards.
The thing about Bosch is that there is very limited material for me to refer to online.
I have already referred to SDKs from Bosch and Ozeki but I can't seem to figure out the codes. I sought help from a few people and they told me to use Onvif (I am unsure how to use it).
I would greatly appreciate all of the help I could get, and if possible explained in simple terms. Thank you so much!
You can view and record the Bosch Dinion camera with the TVideoGrabber SDK and this sample code:
VideoGrabber1.VideoSource = vs_IPCamera
VideoGrabber1.IPCameraURL = "rtsp://admin:password#192.168.1.34/rtsp_tunnel?h26x=4&line=1&inst=1"
VideoGrabber1.RecordingMethod = rm_MP4
VideoGrabber1.RecordingFileName = "c:\folder\filename.mp4"
VideoGrabber1.StartRecording()
ONVIF (Open Network Video Interface Forum) is a global and open industry forum with the goal of facilitating the development and use of a global open standard for the interface of physical IP-based security products – or, in other words, to create a standard for how IP products within video surveillance and other physical security areas can communicate with each other. ONVIF is an organization started in 2008 by Axis Communications, Bosch Security Systems and Sony.
Thanks wikipedia^
At first, you should try to establish a connection to your camera using the OnvifDeviceManager (disponible at this link)
The OnvifDeviceManager is a tool made to test if your camera is ONVIF conformant.
If you're able to get a video feed/ptz control of your camera, it means it shouldn't be that hard to make an app for your needs.
There's two part to the app you want to make:
1) Communicating to the camera.
2) Showing/recording the video stream
In part 1 you want to be able to send request to your camera and get responses from it. You could use this example to make your first ONVIF request to one of your camera... You'll then want to get the stream URL with a request you'll make
In part 2 you want to take the streaming link you'll get from your request and show it somewhere with some tools... I personally used VLC.DOTNET to add a vlcControl to my C# form and show the stream of my camera. There's help to do so on this link.
Good luck, have fun developing your app!

How to save/ load game data for webGL

I've used playerprefs and also added serialization, everything works but i need another way of saving and loading because i have the game on a website, and on the site, there's a login, i need to find out if there is a way to save data to a persons account and also be able to load the data back into the game when the person logs in , even from a different pc
There's many ways to do this. You can write your own server side code, or use a third party plugin to accomplish this.
If you're interested in trying your own implementation, Unity Wiki's Server Side Highscore is an excellent starting point.
The example contains a step-wise explanation on how to setup your database, some PHP code (which allows you to GET & POST) and Unity side code in both JS & C#.
Some time back I have created a server for writing data on server for my webGL game in unity. Here is path of git repository.

Creating an online high score table

I want to create a very simple online high score table for my recently developed game in Windows 8 (C# and XAML).
What's the easiest and fastet way to do this?
WITHOUT A DOUBT WINDOWS AZURE MOBILE SERVICES, and yes I'm shouting :)
All of the infrastructure you need is provided in the cloud, and you get a client SDK that makes recording the score literally a one-liner. Take a look a my blog post on doing exactly this (along with incorporating push notifications). The post covers an HTML 5/JavaScript game, but I think you'll easily be able to translate to C#/XAML.
Windows Azure Mobile Services is free*, you can get access with the Windows Azure 3-month trial offer, and after that expires you're service remains free (although you will pay for data, in your case probably $5 a month)
I would use HttpClient and simple PHP script that would be reciving scores with post method and second one that would be displaying these scores.
The first thing you need is a server that is up ALL the time and able to handle the traffic. I use Godaddy hosting. Its cheap and great service and easy to ftp to.
Next you need a php page.
The php page should grab GET data out of the URL regarding the score and user info
There are a couple ways you can implement the score recording.
1. You could have the receiving php page alter and sort a master file that contains a userid and score list
2. You could have the receiving php page save a unique txt file for each player id and stick their score in it. Then when your app calls for the scores it can pull all of the txt files and sort them on the phone.
Personally I prefer way one.
Finally you need a domain name that you can point your app too. You will need a directory for sending info and one for receiving.
I glossed over a TON of stuff. An experienced developer could do this in a day. To debug it though it would take some time. Good luck
If you're used to C#, build an ASP.NET MVC web application. You can develop and test this locally without going live. MVC may have a tough learning curve, but it's a great framework, and uses technologies you may already be familiar with as a C# coder, such as Linq. You need a database, and Visual Studio should help you get started with all of this.
You want a post or get controller action, with a url like http://server.com/scores/player1. An HTTP GET on that url could return the view of the scores, whereas a post to that url with parameters of, say, difficulty=easy and score=1100.
Your game client could use either WebClient (simpler) or HttpWebRequest for finer control. Build a class that encapsulates the scoring interaction, with a method that can get all high scores, and another method that sends a new score to the scoring server with args playername and score.
Get that up and going as a demo on your localhost, then maybe think about how to restrict players from posting their own scores, like having the game client authenticate with the server.
use service , or httpclient to update the score
Xbox live services have leader-boards support. Since you have a Win8 game you should look at this video from //build 2012 : Building Cross-Device Xbox Games, they get into useful details around 30 min into the video.

C# - Xbox Live Stat Grabber

I'm working on an xbl stat grabber. I have a problem I dont understand how to get the "gamer card"
Heres an example : http://www.youtube.com/watch?v=6HA-uz_v6A0&feature=related
I already have the avatar but I don't get how you can grab the stats and recent games...
You need access to the Xbox Live API, I think you have to apply to Microsoft to get on their 'Community Developer' programme, although it's a bit hazy on the site as to whether they are accepting applications or not.
One kind fellow (who I think is a Microsoft employee) saw that this was a terrible oversight from his employers decided to offer as web service that plugged into the Xbox Live network so you can pull statistics down, you can find info about it and a website here: -
http://duncanmackenzie.net/Blog/put-up-a-rest-api-for-xbox-gamertag-data
It's very comprehensive and should give you all the data you need (Gamerscore, current status, last game played etc)
EDIT: Extra stuff that might help
I'm not too familiar with C# but the process of using the service would be to do the following in your application: -
Construct your URL with a/your gamertag as the argument
Use some URL/Networking API (C#/.NET must have something like this somewhere) to load the URL and retrieve the contents. This should return you a big string containing a bunch of XML
Parse the XML into your application using some sort of XML parsing API (again, I'd imagine C#/.NET has these things built into the framework)
From the looks of the program, the gamercard info looks as if it is just an embedding based upon the gamer tag. You can find info on embedding your Xbox Live gamercard here.
The video author said the Halo stat information is coming courtesy of a site called HaloCharts.com. I don't know if he is embedding the information, perhaps reading an RSS feed, or if he is extracting data from the HTML.

Question on Speech Recognition classes in .NET

Is it possible to have an application built using the .NET speech recognition classes and pass in a WAV file for it to go through and create a text representation of it. For example, this what I'm trying to do:
We have a QA department at my office and they have to listen to hundreds of calls a day which is quite impossible, and there's not enough people listening to everything to keep up. What I want to do is have the audio file uploaded to our server and have the server parse it and create a transcript of it. It doesn't matter if it's not perfect, but just a base which would be easier to skim through a couple of dozen lines of text than listen to a 2 hour recording.
Based on a saved transcript I can implement full-text search in the database and also run checks against the transcript if someone is saying something that's a misrepresentation.
So, is it possible to create an application using the .NET speech recognition classes and just pass the WAV file to it and it spit out a rough transcript?
I've dug around MSDN on the Speech classes briefly while thinking up the idea, so I don't have that much knowledge if it's possible to be done.
If possible, I would appreciate any examples in C#. Topic 1055347 is similar to the question I'm having, and was provided links, the most specific of which is in C++. I'm not a C++ developer, nor have I ever went to school for programming, I'm all self though C#, so I would like to stay in the language that I know.
Thanks in advance!
This sounds like you've got a call center type of application. Microsoft Speech Server has a SR engine optimized for telephony (8000 Hz sample rate), which will generate much better recognitions than the desktop SR engine. However, the engine isn't really designed for transcription (although it can do it), and the transcriptions definitely need to be reviewed before further processing occurs. Microsoft Exchange Unified Communications uses the SR engine to generate transcripts of voice mail, and while it's better than nothing, it often generates amusing nonsense.
With areas like speech recognition you are likely to either find a stand alone EXE or an API in c/c++.
For the links in the other topic, you can use a tool like P Interop Assistant to generate C# code. The C# code acts like a wrapper around the unmanaged dll, so you can call it from c#.
This is likely to be the best way to get the functionality you are looking for.
Yes.
I did such an application a few years ago on the Tablet PC; you can read about it at http://web.archive.org/web/20060615192119/www.devx.com/TabletPC/Article/30761 (At the time, I spoke of using Interop to access the libraries, but I believe that the programming model has remained the same, just with a managed wrapper.)
At the time, the results were very poor, but maybe for your use-case better than nothing.
How about route the calls to Google Voice? I'm sure there are similar services. I have been amazed at its accuracy so far, plus you can click and listen to it if required. Google Voice will forward voice calls to SMS or email.
UPDATE: On reread, maybe since you are recording calls it won't work as I yous the voice message left.

Categories