HandTracker

Detects hands in an image.

public class HandTracker : IDisposable

Implements System.IDisposable interface.

Constructors

Name
Description

HandTracker()

Creates a new HandTracker object.

Properties

Name
Type
Description

Version

string

Read-Only. The API version.

Copyright

string

Read-Only. The API copyright.

Methods

Name
Return Type
Description

List<Hand>

Detects hands for the specified Texture2D.

Load(UnityEngine.Color32[], int, int)

List<Hand>

Detects the hands from the specified color array, width and height.

Load(byte[], int, int, int)

List<Hand>

Detects hands for the specified image data, width, height and channels.

Dispose()

void

Releases unmanaged resources

Example

The example shows how to detect hands with the HandTracker class.

Create a HandTracker

HandTracker handTracker = new HandTracker();

Detect hands in Texture2D

To detect hands in a Texture2D, create a Texture2D and load an image. There are multiple ways to load an image. You could load it from a webcam using the WebcamSource, from a file in the Assets folder or from a file on your disc.

After loading the image to the texture there are 3 different ways to detect hands in that image:

The simplest is to detect hands for the specified Texture2D.

If you need to run the detection in another thread, for example, you can get the texture pixels and detect hands for the specified color array.

Alternatively, you can get the texture raw data and detect hands for the specified byte array.

Detect hands in an image file

To detect hands in an image file, load the file and detect hands for the specified byte array.

Dispose Handtracker

Once tracking is no longer needed, it's recommended to dispose of the HandTracker. You can do that either in the OnApplicationQuit() or the OnDestroy() methods.

Last updated