41
The Kinect Recognizing Human Figure Programming The Kinect Sensor Simone Zenzaro 30/04/2014 The Kinect Sensor

The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

The Kinect Sensor

Simone Zenzaro

30/04/2014

The Kinect Sensor

Page 2: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Table of contents

The KinectOverviewDevice CapabilitiesOther Devices

Recognizing Human FigureBuilding The Depth MapSkeleton Recognition

Programming

The Kinect Sensor

Page 3: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Overview

The MS Kinect

I Motion sensing input devices

I Developed by Microsoft

I Based on Prime Sensehardware

I Released in USA onNovember 4, 2010

I Sold more than 8 millionunits in the first two months.

The Kinect Sensor

Page 4: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Overview

Name Origin

I First known as Project NatalI Alex Kipman, who incubated the project and is from Brazil,

chose Natal, a city along the northeastern coast of Brazil, as atribute to his country.

I Kinetic + ConnectI From Greek kinetikos (moving)I From Latin nexus (to bind, link)

The Kinect Sensor

Page 5: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Overview

Applications

I 3d environmentreconstruction

I Healthcare

I NUIs and gesturerecognition

I Sign language

I Behavioural research

I Security surveillance

I Virtual reality

I ...

The Kinect Sensor

Page 6: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Device Capabilities

I Full body 3d motion capture

I Facial recognition

I Voice recognition

The Kinect Sensor

Page 7: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Main Components

I RGB camera

I Infrared laser

I Monochrome CMOS sensor(Active Pixel Sensor)

I Multi-array microphone

I Tilt Motor

I Accelerometer

The Kinect Sensor

Page 8: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Interaction SpaceThe field of view of the Kinect cameras

The Kinect Sensor

Page 9: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Depth Space Range

The Kinect Sensor

Page 10: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

RGB Camera

Data type, resolution and framerate:

I InfraredResolution640x480Fps30

I RawBayerResolution1280x960Fps12

I RawBayerResolution640x480Fps30

I RawYuvResolution640x480Fps15

I RgbResolution1280x960Fps12

I RgbResolution640x480Fps30

I YuvResolution640x480Fps15

The Kinect Sensor

Page 11: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Depth Sensor

Resolutions and framerate:

I 320x240, 30 Fps

I 640x480, 30 Fps

I 80x60, 30 Fps

The Kinect Sensor

Page 12: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Skeletons

I Up to 6 person recognized

I Up to 2 skeleton tracked

I 20 joints tracked

I Users facing the sensor arerecognized better

I Default and seated Mode

The Kinect Sensor

Page 13: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Accelerometer

I 3-axis accelerometer

I 2g range

I 3d vector pointing in thedirection of gravity

I Right-handed coordinatesystem centred on the sensor

The Kinect Sensor

Page 14: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Device Capabilities

Microphone

I 4 microphones are used todetect the position of thesound source

I Supports noise suppressionand echo cancellation

I Speech recognition viaMicrosoft.Speech API

The Kinect Sensor

Page 15: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Other Devices

Similar Devices

I Leapmotion

I Intel PerceptualI Kinect 2

I 1080p HD videoI Wider/expanded field of

viewI Improved skeletal tracking

The Kinect Sensor

Page 16: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Recognizing Human Figure

Two stage process:

1. Compute depth map(structured light analysis)

2. Infer body position (machinelearning)

The Kinect Sensor

Page 17: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Building The Depth Map

Structured Light

I The technique of analysing aknown pattern

I Project a known pattern andinfer depth from thedeformation of that pattern

The Kinect Sensor

Page 18: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Building The Depth Map

IR Pattern

The Kinect Sensor

Page 19: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Building The Depth Map

Kinect IR Pattern

The Kinect Sensor

Page 20: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Building The Depth Map

Frame From Focus

I More blur means moredistance

I The kinect uses special”astigmatic” lens

I A projected circle thenbecomes an ellipse whoseorientation depends ondepth

The Kinect Sensor

Page 21: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Building The Depth Map

Stereo ImagesRecover depth by finding image coordinate x’ that corresponds to x

The Kinect Sensor

Page 22: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Building The Depth Map

Stereo Images From One Image

The Kinect Sensor

Page 23: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Skeleton Recognition

Body parts recognition

The Kinect Sensor

Page 24: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Skeleton Recognition

Segmentation

I Starts with 100,000 depth images with known skeletons

I For each real image, render dozens more using computergraphics techniques

I Learn a randomized decision forest, mapping depth images tobody parts

The Kinect Sensor

Page 25: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Skeleton Recognition

Classification

I Is that pixel ”background”?

I How does the (normalized)depth at that pixel compareto this pixel?

I Outputs are actuallyprobability distributions

I Distributed algorithm

The Kinect Sensor

Page 26: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Skeleton Recognition

The Skeleton

I Mean shift clustering to find center of mass

I Propose skeleton joints

The Kinect Sensor

Page 27: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Programming With The Kinect

A lot of APIs:

I OpenNI (R.I.P. Thanks to Apple since April)

I OpenKinect (http://openkinect.org/)

I Kinect SDK (http://www.microsoft.com/en-us/download/details.aspx?id=40278)

The Kinect Sensor

Page 28: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Enumerate Kinect sensors

private KinectSensor sensor;

...

foreach (var potentialSensor in

KinectSensor.KinectSensors)

{

if (potentialSensor.Status ==

KinectStatus.Connected)

{

this.sensor = potentialSensor;

break;

}

}

The Kinect Sensor

Page 29: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Enable Data Streaming

if(this.sensor != null)

{

this.sensor.ColorStream.Enable(

ColorImageFormat.RgbResolution640x480Fps30);

this.sensor.DepthStream.Enable(

DepthImageFormat.Resolution640x480Fps30);

this.sensor.SkeletonStream.Enable ();

}

The Kinect Sensor

Page 30: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Starting the sensor

if (this.sensor != null)

{

this.sensor.Start();

}

The Kinect Sensor

Page 31: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Registering and handling sensor stream

private byte[] colorPixels;

this.colorPixels = new

byte[this.sensor.ColorStream

.FramePixelDataLength ];

...

if (this.sensor != null){

this.sensor.ColorFrameReady +=

this.SensorColorFrameReady;

}

The Kinect Sensor

Page 32: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Saving raw data

using (ColorImageFrame colorFrame =

e.OpenColorImageFrame ()){

if (colorFrame != null){

colorFrame.CopyPixelDataTo(

this.colorPixels);

...

}

}

The Kinect Sensor

Page 33: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Getting a bitmap

private WriteableBitmap colorBitmap;

this.colorBitmap = new WriteableBitmap(

this.sensor.ColorStream.FrameWidth ,

this.sensor.ColorStream.FrameHeight ,

96.0, 96.0, PixelFormats.Bgr32 , null);

// Write the pixel data into our bitmap

if (colorFrame != null) {

this.colorBitmap.WritePixels(

new Int32Rect(0, 0,

this.colorBitmap.PixelWidth ,

this.colorBitmap.PixelHeight),

this.colorPixels ,

this.colorBitmap.PixelWidth *

sizeof(int) ,0); }

The Kinect Sensor

Page 34: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Get Depth Pixel

private void DepthImageReady(object

sender , DepthImageFrameReadyEventArgs

e) {

using (DepthImageFrame depthFrame =

e.OpenDepthImageFrame ()){

if (depthFrame != null){

depthFrame.

CopyDepthImagePixelDataTo(

this.depthPixels);

}else{

// depthFrame is null because

the request did not arrive

in time

}

}}The Kinect Sensor

Page 35: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

From Depth to RGB

int minDepth = depthFrame.MinDepth;

int maxDepth = depthFrame.MaxDepth;

int colorPixelIndex = 0;

for (int i = 0; i <

this.depthPixels.Length; ++i) {

// Get the depth for this pixel

short depth = depthPixels[i].Depth;

byte intensity = (byte)(depth >= minDepth

&& depth <= maxDepth ? depth : 0);

The Kinect Sensor

Page 36: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

From Depth to RGB (2)

this.colorPixels[colorPixelIndex ++]

= intensity;

this.colorPixels[colorPixelIndex ++]

= intensity;

this.colorPixels[colorPixelIndex ++]

= intensity;

++ colorPixelIndex;

}

The Kinect Sensor

Page 37: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Get Skeleton Data

private void

kinect_SkeletonFrameReady(object

sender , SkeletonFrameReadyEventArgs e){

// Open the Skeleton frame

using (SkeletonFrame skeletonFrame =

e.OpenSkeletonFrame ()){

// check that a frame is available

if (skeletonFrame != null &&

this.skeletonData != null) {

// get the skeletal information in

this frame

skeletonFrame.CopySkeletonDataTo(

this.skeletonData);

}}}

The Kinect Sensor

Page 38: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Kinect Explorer

The Kinect Sensor

Page 39: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Fusion

3d object scanning and model creation using a Kinect

The Kinect Sensor

Page 40: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

Kinect Studio

The Kinect Sensor

Page 41: The Kinect Sensor - unipi.itdidawiki.cli.di.unipi.it/lib/exe/fetch.php/rhs/rhs... · 2014. 5. 5. · The Kinect Recognizing Human FigureProgramming Overview Name Origin I First known

The Kinect Recognizing Human Figure Programming

More...

Live Demo

The Kinect Sensor