Share via


Creating a PowerPoint add-in that uses Kinect to move through slides

If you are interested in developing Kinect applications, you can start with the latest version of Kinect SDK, available here:

https://www.microsoft.com/en-us/kinectforwindows/develop/developer-downloads.aspx

After installing the SDK, you might want to install the Developer Toolkit also, in order to study the source code for different functionalities. The Toolkit is available here:

https://www.microsoft.com/en-us/download/details.aspx?id=34807

 

You have plenty of sample projects for the various things that you can program for Kinect, from gesture recognition to face or voice recognition.

 

Once you installed those two things, you can start developing something interesting. For example, in the sample projects you have an application that demonstrates how to use swipe gestures to browse through a photo archive. In this tutorial, we will use the same functionality to create a more useful application: an add-in that allows a presenter to swipe through the slides of his PowerPoint presentation.

In order to do that, we will use a few elements:

  1. The Kinect drivers and SDK. Be aware that the Kinect drivers are not available separately, but only inside the SDK, and if you will want to install your final application on another machine, you will need
    to install the SDK on that machine also
  2. The Kinect sensor
  3. An add-in containing code for gesture recognition and for PowerPoint slide change
  4. Visual Studio 2010

 

First, create a PowerPoint 2010 Add-in in VS 2010, by choosing the standard project template.

In the Kinect Developer Toolkit, you will find a sample application named “Slideshow Gestures – WPF”. Install the project and open it with VS 2010.
Look at the references and you will see that it uses a .dll named Microsoft.Samples.Kinect.SwipeGestureRecognizer.dll.
Copy this dll to your Add-in project and add it to references, as it will be in charge of the swipe gesture recognition.

Add these two using directives to the main page of your project:

 

 using Microsoft.Samples.Kinect.SwipeGestureRecognizer;
using Microsoft.Kinect;
 

 

 

And then, in the AddIn class, declare the Kinect sensor and the Recognizer private members:

  

 private KinectSensor nui;
private Recognizer activeRecognizer;
 

 

 

 

In the Startup method of the AddIn application, we initialize these variables:

 

 private void ThisAddIn_Startup(object sender, System.EventArgs e) 
 {
 this.activeRecognizer = his.CreateRecognizer();
 this.InitializeNui();
 }

 

 

In the CreateRecognizer method, we hook to the swipe events of the gesture recognizer:

 

 

  private Recognizer CreateRecognizer()
 {
 // Instantiate a recognizer.
 var recognizer = new Recognizer();
 // Wire-up swipe right to manually advance picture.
 recognizer.SwipeRightDetected += (s, e) =>
 {
 try
 {
 this.Application.ActivePresentation.SlideShowWindow.View.Next();
 }
 catch (Exception ex)
 {
 //…
 }
 };

 

 

 

          

  recognizer.SwipeLeftDetected += (s, e) =>
 {
 try
 {
 this.Application.ActivePresentation.SlideShowWindow.View.Previous();
 }
 catch (Exception ex)
 {
 //…
 }
 };
 return recognizer;
 }

 

 

In the InitializeNui() method, we are checking for all the available Kinect sensors:

  

  private void InitializeNui()
 {
 this.UninitializeNui();
 var index = 0;
 while (this.nui == null && index < KinectSensor.KinectSensors.Count)
 {
 try
 {
 this.nui = KinectSensor.KinectSensors[index]; 
 this.nui.Start(); 
 this.IsDisconnected = false;

 

 

You will find all this code in the “Slideshow Gestures” application from the Kinect Developer Toolkit. In our PowerPoint Add-in application, we are only using a part of that code, to achieve the intended functionality.

As you can see, the main actions are sliding through the PowerPoint presentation when the Recognizer is capturing a swipe left/right event.

Next, you only need to create an installation package to distribute this add-in. In the Solution Explorer, right-click on the project and select Publish. Specify a location on the disk and click Next. Choose “From a CD-ROM…” and click Next, then Finish.

Install the add-in on a presentation machine and check these steps to make sure it is properly installed: In PowerPoint, to File->Options->Add-Ins. In the “Active Application Add-ins”, you should see the add-in. If the add-in is not present, verify the “Manage: “ list at the bottom of the page: select COM add-ins in the list, click Go, check the <name of your addin> option in the list, click OK.

 

To connect the Kinect sensor to your PC, you need a Kinect adapter, as the connector of Kinect doesn’t match the USB of your PC, and they also need an external power source. Once the Kinect sensor is connecter and the PowerPoint presentation is started, the red light on the sensor should be on, which indicates that the sensor is recognized by the application.

Start the PowerPoint slideshow.

Stand in front of the Kinect sensor at a distance between 1.5 meters and 4 meters

To move to the next slide, do a swiping movement with your right hand, from right to left. The hand should be at chest-level and the movement should be continuous

To move to the previous slide, do a swiping movement with your left hand, from left to right

 

That would be all. You can use this sample in your team presentations, to leverage the Kinect technology and demonstrate that it can have a multitude of uses, outside the gaming world.

You can download the sample from here: https://sdrv.ms/13PMDX0