Book Image

Augmented Reality with Kinect

By : Rui Wang
Book Image

Augmented Reality with Kinect

By: Rui Wang

Overview of this book

Microsoft Kinect changes the notion of user interface design. It differs from most other user input controllers as it enables users to interact with the program without touching the mouse or a trackpad. It utilizes motion sensing technology and all it needs is a real-time cameras, tracked skeletons, and gestures. Augmented Reality with Kinect will help you get into the world of Microsoft Kinect programming with the C/C++ language. The book will cover the installation, image streaming, skeleton and face tracking, multi-touch cursors and gesture emulation. Finally, you will end up with a complete Kinect-based game. Augmented Reality with Kinect will help you get into the world of Kinect programming, with a few interesting recipes and a relatively complete example. The book will introduce the following topics: the installation and initialization of Kinect applications; capturing color and depth images; obtaining skeleton and face tracking data; emulating multi-touch cursors and gestures; and developing a complete game using Kinect features. The book is divided in such a way so as to ensure that each topic is given the right amount of focus. Beginners will start from the first chapter and build up to developing their own applications.
Table of Contents (14 chapters)
Augmented Reality with Kinect
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Cutting the fruits


Now we really want to "cut" something instead of just seeing the trailing effect. To simplify the process, we should have the following prerequisite conditions:

  • The fruit and bomb objects are represented by a 2D RGBA image with a transparent background. The positions and states (whether sliced or not) are updated in every frame.

  • The fruit is thrown from the bottom of the screen with a random initial velocity. It will fall down because of gravity.

  • When the hand points reach the object image (in fact, a rectangle), it is divided into four parts as if sliced by a mystical ninja.

The code doesn't need to be related with Kinect, but we will have to pass the hand points and velocities to determine if a fruit object is cut. All these operations can be done in the update() function.

It is also important to find or create some fruit and bomb images (using cartoon styles may be a good idea). In this simple example, we choose the following ones:

Fruits/bomb images with a transparent background...