/Kinect-Drawing

A simple drawing app using Kinect, C#, and XAML.

Primary LanguageC#MIT LicenseMIT

Kinect Drawing

A simple drawing app using Kinect, C#, and XAML.

This short demo project will show you the following:

  • How to track a hand using Kinect version 2.
  • How to display the camera stream.
  • How to draw the trail of the hand on top of a XAML canvas.

Video

Watch on YouTube

Tutorial_

Read a step-by-step tutorial

Prerequisites

How to run

Simply download the project and hit "Start" using Visual Studio. This project is a showcase demo.

XAML Canvas

	<Image Name="camera" />
	<Canvas Name="canvas">
		<Polyline Name="trail" Stroke="Red" StrokeThickness="15" />
	</Canvas>

Drawing

	Joint handRight = body.Joints[JointType.HandRight];

	if (handRight.TrackingState != TrackingState.NotTracked)
	{
		CameraSpacePoint handRightPosition = handRight.Position;
		ColorSpacePoint handRightPoint = _sensor.CoordinateMapper.MapCameraPointToColorSpace(handRightPosition);

		float x = handRightPoint.X;
		float y = handRightPoint.Y;

		if (!float.IsInfinity(x) && ! float.IsInfinity(y))
		{
			// DRAW!
			trail.Points.Add(new Point { X = x, Y = y });
		}
	}

The DataSet

  • Check out the DataSet Folder
  • It contains 5 classes (Rectangle, Triangle, Circle, Line, Polygone)
  • Used to train the model for classification

The Training Notebook

  • Used for custome training using the DataSet provided in the repo.

Contributors

License

You are free to use this source code in personal and commercial projects. Licensed under the MIT License.