Creating Windows Applications with Kinect Functionality

Similar documents
Using MATLAB to Measure the Diameter of an Object within an Image

APPLICATION NOTE. Getting Started with pylon and OpenCV

OPERATION MANUAL. MV-410RGB Layout Editor. Version 2.1- higher

Chapter I Model801, Model802 Functions and Features

Develop a Hello World project in Android Studio Capture, process, store, and display an image. Other sensors on Android phones

Kinect Interface to Play Computer Games with Movement

Guide to Installing BBL Crystal MIND on Windows 7

INTERNAL USE ONLY (Set it to white if you do not need it)

How to install and use the File Sharing Outlook Plugin

INTERNAL USE ONLY (Set it to white if you do not need it)

VHS2DVD Wizard User's Manual

Designing a Graphical User Interface

Quick Start Guide. Installing. Setting up the equipment

Using Flash Media Live Encoder To Broadcast An Audio-Only Stream (on Mac)

Development of 3D Image Manipulation Software Utilizing the Microsoft Kinect

How To Run A Factory I/O On A Microsoft Gpu 2.5 (Sdk) On A Computer Or Microsoft Powerbook 2.3 (Powerpoint) On An Android Computer Or Macbook 2 (Powerstation) On

INTERNAL USE ONLY (Set it to white if you do not need it)

Lesson 10: Video-Out Interface

Be sure to connect the USB cable from TonePort into your computer s USB port, and then proceed with the following steps

wpf5concat Start Microsoft Visual Studio. File New Project WPF Application, Name= wpf5concat OK.

Advanced Outlook Tutorials

EIZO Monitor CalMAN Setup Guide

Capture video in 1080p HD

Video Tracking Software User s Manual. Version 1.0

GETTING STARTED WITH MEKKO GRAPHICS A GUIDE FOR MS OFFICE 2007, 2010, AND 2013 USERS. 10/21/2014 MG6.9 Of07/10/13

Mirror Mount Video Monitor/Recorder with Front and Rear View Night Cameras PLCMDVR5

Important HP Media Center PC Updates

Camtasia: Importing, cutting, and captioning your Video Express movie Camtasia Studio: Windows

Video Upload and Management

To Begin Customize Office

Gesture-Based Human-Computer-Interaction Using Kinect for Windows Mouse Control and PowerPoint Presentation

Sense. 3D Scanner. User Guide. See inside for use and safety information.

DESIGN OF A TOUCHLESS USER INTERFACE. Author: Javier Onielfa Belenguer Director: Francisco José Abad Cerdá

Windows Presentation Foundation Tutorial 1

SMART BOARD USER GUIDE FOR PC TABLE OF CONTENTS I. BEFORE YOU USE THE SMART BOARD. What is it?

R11.2 SecureAssess Local Installation Guide. October 2014

Audio Only Broadcast through Flash Media Live Encoder On Windows

3D Input Format Requirements for DLP Projectors using the new DDP4421/DDP4422 System Controller ASIC. Version 1.3, March 2 nd 2012

FB-500A User s Manual

Field Calibration Software

Users Manual Model # English

Affdex SDK for Windows!

USB 3.0 to HDMI External Multi Monitor Graphics Adapter with 3-Port USB Hub HDMI and USB 3.0 Mini Dock 1920x1200 / 1080p

HTML Code Generator V 1.0 For Simatic IT Modules CP IT, IT, IT

USB PC Camera User s Guide

GETTING STARTED WITH SQL SERVER

COMPRESS Installation Guide

Multi-Profile CMOS Infrared Network Camera

Motion Activated Camera User Manual

MOVEIRO BT-200 Technical Information for Application Developer

Network Video Recorder. User s Manual v Model: SVR-504/508/516/516+

AdSysTech Version 5. Swipe Card Manual. Written and Provided by the Pikes Peak United Way Community Information System Team

Podium View TM 2.0 Visual Presenter Image Software User Manual - English (WINDOWS)

Note: A WebFOCUS Developer Studio license is required for each developer.

CONTENTS. Section 1 Document Descriptions Purpose of this Document Nomenclature of this Document... 3

آموزش DataGrid در WPF به همراه صفحه بندي و جستجوي انتخابی. کلیک کن

How To Use Bodescan For 3D Imaging Of The Human Body

How to get ebooks on Reader

Basic Specifications. Electrical. EPSON Perfection Color EPSON MatrixCCD TM line sensor. device Effective pixels

USB 3.0 to VGA External Multi Monitor Graphics Adapter with 3-Port USB Hub VGA and USB 3.0 Mini Dock 1920x1200 / 1080p

Digital Persona Fingerprint Reader Installation

Embroidery Fonts Plus ( EFP ) Tutorial Guide Version

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

AXIS Camera Station Quick Installation Guide

Adding Animation With Cinema 4D XL

KINECT PROJECT EITAN BABCOCK REPORT TO RECEIVE FINAL EE CREDIT FALL 2013

Transmitter Interface Program

Welcome to Corel VideoStudio Pro X5

What Do I Need To Create a Visualization For ScreenPlay?

Driver s License Camera Scanner Installation Guide!

ActiView. Visual Presenter Image Software User Manual - English

Using Microsoft Producer for PowerPoint to Record Accounting Lectures

netduino Getting Started

2. How to Use SMART Board as a Projector and Whiteboard

How to develop your own app

MXL 990 Virtual Preamp Installation

Designing a Schematic and Layout in PCB Artist

Roxio Easy LP to MP3

Chief Architect X6. Download & Installation Instructions. Chief Architect, Inc N. Mineral Dr. Coeur d Alene, Idaho

How To Create a Movie in WeVideo

Gauge Drawing Tool Slider Drawing Tool Toggle Button Drawing Tool One-Way List Drawing Tool... 8

Abstract. Introduction

Using Windows Movie Maker to Create Movies

Digital Story Telling with Windows Movie Maker Step by step

Parallelization of video compressing with FFmpeg and OpenMP in supercomputing environment

Building an Embedded Processor System on a Xilinx Zync FPGA (Profiling): A Tutorial

Microsoft Word 2011: Create a Table of Contents

Practice Management Installation Guide. Requirements/Prerequisites: Workstation Requirements. Page 1 of 5

USB 3.0 Camera User s Guide

Audacity. For use with MFL Speaking Tests. User Guide (Microsoft Windows version)

Data Sheet. Desktop ESPRIMO. General

MassArt Studio Foundation: Visual Language Digital Media Cookbook, Fall 2013

Microsoft Publisher 2010: Web Site Publication

Microsoft Windows Movie Maker

How do I Check if My Computer is Compatible with Windows 7

Software for Producing Rack Layouts and Purchase Orders

Dexcom Portrait on the Web User Guide For Use with the Dexcom G4 PLATINUM Continuous Glucose Monitoring System

User Manual Gigabit Ethernet Vision Quick Start Guide

CINEMA 4D RELEASE 10. Installation Guide 3D FOR THE REAL WORLD

Getting Started with the ZED 2 Introduction... 2

Transcription:

Creating Windows Applications with Kinect Functionality David Zoltowski 3 April 2015 Executive Summary In this application note, I provide a tutorial for creating a Windows application that interfaces with a Kinect for Windows v2 sensor. The Kinect for Windows v2 sensor is a recently developed product with important capabilities, and it is important for consumers to understand how to implement Kinect functionality into their applications. Tutorials from Microsoft and on the web are either incomplete or in video form; I provide a brief, concise documentation. My tutorial will create a Windows application in C# that reads the depth sensing data from the Kinect for Windows v2 sensor and streams an image based on that data to an output window. Keywords Windows application, Kinect, depth sensing, C#

Introduction The Kinect for Windows v2 sensor is a device that can sense depth, capture color images, emit infrared, and input audio [1]. More specifically, the sensor is capable of sensing the depth at a 30 Hz frequency and 512 x 424 resolution and for points further than 0.5 meters from the sensor. The color camera captures 1080p video, also at 30 Hz, and the infrared emitter has similar capabilities. The Kinect for Windows v2 sensor improves on the first version of the device, providing the designated technical spec but also improved body tracking, an expanded field of view, and higher depth fidelity [1]. The sensor used for the Xbox One, but can also be connected to and run on a Windows computer. All of these facts combine to form the notion that the Kinect for Windows v2 sensor (hereafter simply called the Kinect) is a very powerful sensor for use in computer vision and human computer interaction technologies. Microsoft has developed multiple applications for interfacing with the Kinect. Primarily, it developed the Kinect for Windows SDK, most recently version 2.0, which interfaces with the second version of the Kinect. The SDK provides tools to develop Kinect-enabled applications for Windows and samples of developed applications, including Kinect Fusion, a 3D object-scanning and modeling program [2]. Upon downloading the SDK, one can simply run a sample and use the provided functionality. However, one can also install the samples to view and modify them in a programming environment such as Visual Studio, a Microsoft developer tool. A crude documentation of the SDK is provided on Microsoft s website. While it is interesting to interface with developed applications for the Kinect, and also potentially informative, developing applications from scratch allows for much greater creative and learning opportunities. However, the documentation of the SDK does not provide a strong introduction to developing such applications. Also, the samples are very complex and do not yield informative insights easily. Informal guides to developing such applications appear around various Internet pages, but the information is usually spread across multiple pages, documents, or videos. Also, many guides are developed for the first version of the Kinect sensor, as the Kinect v2 is relatively new. A clear, concise introduction to developing Windows applications with Kinect-enabled functionality is needed. Objective The objective of this application note is to provide a step-by-step guide to creating Kinectenabled Windows applications to someone with no experience working with a Kinect but sufficient experience in programming. Potential beneficiaries of this note could be developers who aims to develop Kinect applications or simply programmers who aim to learn more about the capabilities of the Kinect, among others. The tutorial will focus on acquiring and displaying the depth sensing data. The application will be written in C#, and pieces of it will draw from online tutorials [3,4]. Specifically, the developed application will read the depth sensing information from the Kinect sensor and will output a stream of the processed information (such that it looks like an image) to a window. Hardware Requirements 1. Kinect for Windows v2 Sensor, power hub, and USB cabling 2. Computer with the following capabilities

a. 64-bit (x64) processor b. 4 GB Memory (or more) c. I7 3.1 GHz (or higher) d. Built-in USB 3.0 host controller e. DX11 capable graphics adapter Software Requirements 1. Windows 8 or 8.1 (x64) 2. Visual Studio 2012 or 2013 3. Kinect for Windows SDK 2.0 Steps 1. Install required software. Visual Studio 2013 can be downloaded here and the Kinect for Windows SDK 2.0 can be downloaded here. 2. Open Microsoft Visual Studio. 3. Click File > New > Project and under the Visual C# tab, choose WPF Application. 4. Add a reference to your Kinect library. On the right hand side of the application, in the Solution Explorer, right click on References and search for Kinect. Click on and check the box by Microsoft.Kinect and press OK. 5. Click on the MainWindow.xaml tab. In this tab, in between the two <Grid> statements, we will initialize an image titled camera. Place the following line of code in this area: <Image Name= camera /> Figure 1 provides a screenshot of this code in the application. Figure 1. Initialize image 6. Click on the MainWindow.xaml.cs tab. This tab will be the main workspace for this application and is shown in Figure 2.

7. At the top of the file, enter the following to add Kinect functionality: using Microsoft.Kinect; 8. In the public partial class MainWindow : Window, we will start to write our code. In public MainWindow(), below InitializeComponent();, write: this.loaded += OnLoaded; At this point, a new function void Onloaded should be initialized. If not, initialize the function as such: void OnLoaded(object sender, RoutedEventArgs e) Figure 2. Workspace

9. Before we fill in this function, we must get instances of the KinectSensor and DepthFrameReader classes. These classes are used to interact with the Kinect and to stream Depth data. Below the public MainWindow() function write: KinectSensor sensor; MultiSourceFrameReader reader; 10. Finally, we will fill void OnLoaded. In the brackets, place the following code: this.sensor = KinectSensor.GetDefault(); this.sensor.open(); this.reader = this.sensor.depthframesource.openreader(); this.reader.framearrived += OnFrameArrived; This code will get the default sensor, open that sensor, create and open a depth frame reader, and call the method OnFrameArrived when a frame arrives (event happens). The current workspace of application up to this point is shown in Figure 3.

Figure 3. Workspace after step 10 11. Similar to when we created void OnLoaded, we must create void OnFrameArrived. This function will acquire and process the frame every time a frame arrives. We must use the using syntax to acquire the frame, so that the frame is handled correctly. If the frame is not null, we will pass the frame to a function ProcessFrame. ProcessFrame will convert the depth frame to a BitmapSource image, and we will set camera in the output window to this image. Place this method after void OnLoaded: void OnFrameArrived(object sender, DepthFrameArrivedEventArgs e) using (var frame = e.framereference.acquireframe()) if (frame!= null) camera.source = ProcessFrame(frame); A screenshot of this function in the application is shown in Figure 4.

Figure 4. OnFrameArrived 12. Finally, we must create the ProcessFrame method. The goal of ProcessFrame is to convert the depth frame into an image that displays pixels furthest away as black, pixels closest as white, and pixels in between as shades of grey in between black and white. This method was acquired from a webpage [3]. private ImageSource ProcessFrame(DepthFrame frame) int width = frame.framedescription.width; int height = frame.framedescription.height; PixelFormat format = PixelFormats.Bgr32; ushort mindepth = frame.depthminreliabledistance; ushort maxdepth = frame.depthmaxreliabledistance ushort[] pixeldata = new ushort[width * height]; byte[] pixels = new byte[width * height * (format.bitsperpixel + 7) / 8]; frame.copyframedatatoarray(pixeldata); int colorindex = 0; for (int depthindex = 0; depthindex < pixeldata.length; ++depthindex) ushort depth = pixeldata[depthindex]; byte intensity = (byte)(depth >= mindepth && depth <= maxdepth? depth : 0); pixels[colorindex++] = intensity; // Blue pixels[colorindex++] = intensity; // Green pixels[colorindex++] = intensity; // Red ++colorindex;

int stride = width * format.bitsperpixel / 8; return BitmapSource.Create(width, height, 96, 96, format, null, pixels, stride); 13. Now, the application should be finished. Build and debug the application, and a streaming depth image should appear, similar to the one in Figure 5. If not, please check your code and that you correctly followed the steps. Figure 5. Output window Conclusion This application note provides a step-by-step guide to creating a Windows application in C# that can acquire depth frame data from a Kinect for Windows v2 camera, process the data, and stream the processed data to an output image. It is intended as an introduction to interacting with the Kinect in Microsoft Visual Studio. The Kinect has many more features, including color capture, infrared emission, and face and body recognition, and with this tutorial users should have a strong foundation to start working with these other functionalities. References 1. Microsoft. "Kinect for Windows Features." Kinect for Windows Features. Web. 31 Mar. 2015. 2. Microsoft. "Kinect for Windows SDK." Kinect for Windows SDK. Web. 31 Mar. 2015. 3. Pterneas, Vangos. "Kinect for Windows Version 2: Color, Depth and Infrared Streams." CodeProject. N.p., 21 Feb. 2014. Web. 31 Mar. 2015. 4. Taulty, Mike. "Kinect for Windows V2 SDK: 3 'Hello World' Videos - Mike Taulty's Blog - Mike Taulty's Blog." Mike Taulty's Blog. N.p., 20 Feb. 2015. Web. 01 Apr. 2015.