Archived - Intel® RealSense™ made easy with SharpSenses

The Intel® RealSense™ SDK has been discontinued. No ongoing support or updates will be available.

Many developers worldwide are taking advantage of the Intel® RealSense™  technologies to create really amazing applications with a whole new dimension for user interaction.

Intel® provides an SDK that exposes all the features of the R200 and F200 cameras. The SDK is very powerful but it requires some time to find your way into it. To help people to get up and running with just a few lines of code I started SharpSenses.

SharpSenses is an open-source project on top of the SDK designed to simplify Intel® RealSense™ development for C# developers. You can find more about the project on Github.

Prerequisites

First, download and install the SDK: https://software.intel.com/pt-br/intel-realsense-sdk

Second, get a RealSense Camera F200: https://software.intel.com/pt-br/RealSense/F200Camera

Make sure you are using an Intel 4th Generation processor (Haswell) and have an USB 3.0.

Your first project with SharpSenses

In this hello world project we will detect your hand visibility using SharpSenses.

Open the Visual Studio and start a new Command Prompt project:

The first thing we need to do is to add SharpSenses to our project. Thanks to Nuget, this task is very easy:

On the NuGet screen, choose Online and "nuget.org" as source (1), type "sharpsenses.realsense" in the search box (2), wait until the package appears, select it and click "install" (3).

Nuget will take care of the download, installation and configuration of SharpSenses in your project. There is no need to do anything else so let's start coding. In your Program.cs, type:

static void Main(string[] args) {
    var cam = Camera.Create();
    cam.LeftHand.Visible += (sender, args) => {
        Console.WriteLine("Left Hand Visible");
    };
    cam.LeftHand.NotVisible += (sender, args) => {
        Console.WriteLine("Left Hand Not Visible");
    };
    cam.Start();
    Console.ReadLine();
}

The code is pretty much self explanatory, we create our Camera object, subscribe to the left hand "visible" and "not visible" events and we start the camera. That's it: 9 lines and you can detect when your hand is in front of the camera and when it's not.

Make sure the camera is connected, press F5 to debug the application and move your left hand in front of the camera and hide it again.

So, that's all for your first Intel® RealSense™ application. If you are curious, go ahead and try other events like Opened and Closed. Have fun!

About the author

André Carlucci is co-founder and the Director of Technology of Way2 Technology, Microsoft MVP, Intel Innovator and DotNetFloripa usergroup organizer. He has 15+ years of experience working on IT projects in Brazil and Europe. He is currently focused on software architecture, Microsoft Technologies and open-source projects. André is passionate about agile methodologies. Find him on www.andrecarlucci.com and Twitter: @andrecarlucci

For more complete information about compiler optimizations, see our Optimization Notice.