XImplosionX

Step into my mind.

Spotlight Imagine Cup: Team Walk2Help

TeamWalk2Help

Team Walk2Help is a Bulgarian team entering the World Wide Imagine Cup with a neat Windows Phone 7 application. They aim to help reduce carbon emissions while helping out charities.

I was able to sit in on Walk2Help’s presentation, and got quite a bit of insight as to what the project is about. They built a Windows Phone 7 application that tracks the amount of CO2 you save when walking. When you walk, you earn “credits”, that you can then redeem on their website to help charities. The more people walk, the more carbon we save, and the more people we’re able to help.

While they may not have made it much further in the competition, they did an amazing job building their project. The app is available now on the Windows Phone marketplace. Just search fro Walk2Help and make a difference.

If you support Walk2Help, please vote for them in the People’s Choice Awards here.

Until next time,
Patrick Godwin

Spotlight Imagine Cup: Team LifeLens

team1

One of my favorite things about the Imagine Cup is the amazing goals many projects carry. The spirit of the competition is in the innovative thinking of each of the competitors. They come together with the common goal of “Solving the world’s toughest problems”.

Team LifeLens exemplifies this theme greatly. They have decided to tackle Malaria, hoping to make detecting the disease a relatively simple and affordable task. They developed a Windows Phone 7 application that takes pictures of different blood samples and sends them up to a cloud service for processing.

The cloud service then uses computer vision image processing to count the blood cells in the sample. It then goes through and searches for infected cells. The algorithm they developed is currently 98% accurate, as opposed to 62% accurate when they started.

Since arriving in New York for the finals, the team has been excited. They feel that they are “one of the stars of the show”, which they really are. They, along with the over a hundred competitors are all winners on their home turf. Whatever happens now, they’ve all succeeded greatly.

Team LifeLens was featured on CNN the day of the 2011 Opening Ceremonies. They, along with some other Imagine Cup competitors, presented their projects to the world. You can take a look at it here:

Students with Microsoft CEO Steve Ballmer.

You can read the full article here.

LifeLens is already in talks with organizations to promote and test the solution they’ve developed. They believe that, after the Imagine Cup, they can change the world.

If you support their cause, please vote for them in the People’s Choice Awards here. I’ll be bringing constant updates about them, and other competitors, as a part of my coverage of the World Wide Imagine Cup Finals with the Student Partner Social Media Team. You can follow our coverage using the #mspsmt hashtag.

Until next time,
Patrick Godwin

Imagine a World–The 2011 Imagine Cup Card Game

If any of you follow Andrew Parsons, Academic Developer Evangelist for the New York region, on twitter, you may have seen this picture:

337337211

I wondered what could possibly be in all of those boxes, especially with the Imagine Cup in New York City approaching quickly. Well, today I got my answer.

Introducing “Imagine a World”, a card game created by student Stuart Burton:

DSC00009

Andrew came up to me and handed me this deck of cards. It turns out each competitor will be receiving a deck of cards to play with throughout the competition. The rules of the game are as follows.:

First Turn:

  • No effects can be played.
  • Player 1 shuffles and draws 5 cards.
  • Player 2 shuffles and draws 6 cards.

Every turn:

  1. Draw a card.
  2. Buy Tech, Effects, and Team cards.
  3. Attack your opponent.

1. Draw a Card
You must draw a card if you have cards remaining in your deck

2. By Tech, Effects & Team cards
You may buy one Tech, one Effect, and one Team card per turn. Play cards you buy on your field.

3. Attack your opponent
Select one of your Tech cards and attack an opponent’s Tech card. If your Impact is greater than their Wow Factor, their card should be removed from play. Otherwise there is no effect.

Extra Rules

  • World Event cards must be played immediately.
  • You must use Money cards to buy Tech, Effect and Team cards. Other cards in your hand may be used in place of $1 Money cards.
  • You may use multiple Effect cards on a single Tech card.
  • You must wait a turn to use your Tech to attack your opponent unless it is the only Tech card on your field.

Optional Rule

For longer gameplay, players must choose to play cards OR attack per turn, not both.

Winning the game:

A player wins when their opponent can no longer make a play (draw a card, play a card from their hand, make an attack, etc.)

I think it’s really cool that the East Region Academic Team brought this card game to the Imagine Cup. If you enjoy the game, give a shout-out to the team members on twitter:

And remember to read the Microsoft Student Insider and the Microsoft Student Partner coverage of the Imagine Cup finals by using the #MSPSMT and #MicrosoftSI hashtag on Twitter.

Until next time,
Patrick Godwin

Intro to the Kinect SDK–Adding Speech Recognition

For those of you who frequent this blog, you know a few days ago I wrote an introductory article on Kinect and XNA (link). In that article, I modified the Primitive 3D Sample from App Hub to render Joints from Kinect as Primitive Spheres. I’ve decided to build upon that sample, and leverage the Kinect’s NUI Microphone and the Microsoft Speech Recognition SDK to replace touch/keyboard input in the sample. I also refactored the previous sample a bit.

Before we get started, you need to make sure you have some pre-requisites installed:

(Note: The SDK and Runtime are x86, as the Kinect Language Pack is only x86 for now)

Now let’s dive into it. First thing we need to do is add a few more using statements to the project:

using Microsoft.Research.Kinect.Audio;
using Microsoft.Speech.AudioFormat;
using Microsoft.Speech.Recognition;
using System.IO;

Next, add these variables under the variables we created last time:

KinectAudioSource kinectSource;
SpeechRecognitionEngine speechEngine;
Stream stream;
string RecognizerId = "SR_MS_en-US_Kinect_10.0";
bool speechNotRecognized;

These variables go with the rest of the fields we declared in the last tutorial. I’ll explain what each one of these does later. Next, take the Kinect code from our LoadContent function:

nui = new Runtime();
nui.Initialize(RuntimeOptions.UseSkeletalTracking);
nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady);
nui.NuiCamera.ElevationAngle = 0;

And move it to a new function called InitalizeKinect. Your LoadContent function should look like this now:

protected override void LoadContent()
{
    spriteBatch = new SpriteBatch(GraphicsDevice);
    spriteFont = Content.Load<SpriteFont>("hudfont");

    primitives.Add(new CubePrimitive(GraphicsDevice));
    primitives.Add(new SpherePrimitive(GraphicsDevice));
    primitives.Add(new CylinderPrimitive(GraphicsDevice));
    primitives.Add(new TorusPrimitive(GraphicsDevice));
    primitives.Add(new TeapotPrimitive(GraphicsDevice));

    wireFrameState = new RasterizerState()
    {
        FillMode = FillMode.WireFrame,
        CullMode = CullMode.None,
    };

    InitalizeKinect();

}

Let’s dive into that new InitalizeKinect function:

private void InitalizeKinect()
{

    nui = new Runtime();
    nui.Initialize(RuntimeOptions.UseSkeletalTracking);
    nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady);
    nui.NuiCamera.ElevationAngle = 0;

    kinectSource = new KinectAudioSource();

    kinectSource.FeatureMode = true;
    kinectSource.AutomaticGainControl = false;
    kinectSource.SystemMode = SystemMode.OptibeamArrayOnly;

    var rec = (from r in SpeechRecognitionEngine.InstalledRecognizers() where r.Id == RecognizerId select r).FirstOrDefault();

    speechEngine = new SpeechRecognitionEngine(rec.Id);

    var choices = new Choices();
    choices.Add("color");
    choices.Add("shape");
    choices.Add("wireframe");
    choices.Add("exit");

    GrammarBuilder gb = new GrammarBuilder();
    gb.Culture = rec.Culture;
    gb.Append(choices);

    var g = new Grammar(gb);

    speechEngine.LoadGrammar(g);
    speechEngine.SpeechHypothesized += new EventHandler<SpeechHypothesizedEventArgs>(sre_SpeechHypothesized);
    speechEngine.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
    speechEngine.SpeechRecognitionRejected += new EventHandler<SpeechRecognitionRejectedEventArgs>(sre_SpeechRecognitionRejected);

    Console.WriteLine("Recognizing Speech");

    stream = kinectSource.Start();

    speechEngine.SetInputToAudioStream(stream,
                  new SpeechAudioFormatInfo(
                      EncodingFormat.Pcm, 16000, 16, 1,
                      32000, 2, null));

    speechEngine.RecognizeAsync(RecognizeMode.Multiple);

}

This is a lengthy function, but each part is important. Notice at the top, we initialize our Runtime and Skeletal Tracking features like last time.

The next thing to notice is the KinectAudioSource, kinectSource. This is how we access the four microphone array on the Kinect Sensor in code. Right here we create a new instance of KinectAudioSource. We also turn off Automatic Gain and Echo Cancellation, so the speech recognition capabilities can work properly.

Now we need to grab our Kinect Language Recognizer. We do that by checking what speech recognizers exist on the machine, and grab the Kinect Language Recognizer.

We then use the recognizer information we grabbed to create a new instance of SpeechRecognitionEngine. We then create a new Choices object, and add all of the words we want the speech recognition engine to recognize.

Next, we need to create a GrammarBuilder that will help us build the Grammar object used by the SpeechRecognitionEngine object. We set the GrammarBuilder’s Culture using the Speech Recognizer we got earlier, and add our words to the GrammarBuilder.

Next we’re going to wire up a few event handlers. I’m not going to dive into each event handler here, as the only one that’s really important is the SpeechRecognized handler. I’ll explain that in a bit.

Finally, we want to set our stream variable equal to the Kinect’s audio stream. We then tell to use the speech engine to use this stream for audio recognition. The last thing this function does is call the RecognizeAsync function, which tells the SpeechRecognitionEngine object to start looking for recognized words.

Let’s dive into our SpeechRecognized event handler:

void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
    speechNotRecognized = false;
    if (e.Result.Text == "color")
    {
        currentColorIndex = (currentColorIndex + 1) % colors.Count;
    }
    else if (e.Result.Text == "wireframe")
    {
        isWireframe = !isWireframe;
    }
    else if (e.Result.Text == "shape")
    {
        currentPrimitiveIndex = (currentPrimitiveIndex + 1) % primitives.Count;
    }
    else if (e.Result.Text == "exit")
    {
        Exit();
    }
    Console.Write("\rSpeech Recognized: \t{0} \n", e.Result.Text);
}

This function is where the processing work of the recognized audio happens. The SpeechRecognizedEventArgs contains the result of the recognized speech. In the Result property, there is a Text property which you can use to compare against your choices. The code in here is pretty self explanatory. We simply change our rendering properties, currentPrimitiveIndex, isWireframe, and currentColorIndex, to be used later in the Draw function.

Those are most of the important changes. Take a look at the attached sample to see the rest of the minor changes to the Draw function and the other Event Handlers. You can download the entire sample here.

Let me know if you have any feedback on these samples, or if there is anything you can add. I’m always looking for advice, so I’m happy to hear from my readers.

Until next time,

Patrick Godwin

Microsoft releases Kinect for Windows SDK Beta

That’s right, the long awaited Kinect for Windows SDK, first demonstrated at MIX 2011, was released today during a Channel 9 Live event. My fellow Microsoft Student Insider, Dennis Delimarsky, was a member of the presentation, helping them show off the beta tools for Kinect.

The SDK for Windows has many features, from hundreds of pages of API Documentation to multiple samples, the Kinect for Windows SDK is a great way to interact with your technology. The Kinect SDK supports skeletal tracking and audio processing, as well as raw access to the data from the Kinect Sensor.

You can go ahead and download the Kinect SDK for free, educational use from here.

Until next time,
Patrick Godwin

Older Posts »