> For the complete documentation index, see [llms.txt](https://handtracking.lightbuzz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://handtracking.lightbuzz.com/hand-tracking-unity-plugin/quickstart.md).

# QuickStart

Following the steps described in the [Workflow](/hand-tracking-unity-plugin/overview.md#workflow) section, here is how to detect hands and fingers in 3 easy steps:

## Step 1: Load image data

Load an image to a `Texture2D`. The image could be loaded from one of the following sources:

### :frame\_photo: Image file

*An image file is a PNG, JPG, WEBP, or BMP image.*

```csharp
// Create an empty Texture2D.
Texture2D texture = new Texture2D(0, 0);

// Load a file to a byte array.
string filename = "path/to/image";
byte[] rawData = System.IO.File.ReadAllBytes(filename);

// Load an byte array to the Texture2D.
texture.LoadImage(rawData);
```

### &#x20;:movie\_camera: Video file

*A video may by an MP4, AVI, MOV, WEBM, or WMV file.*

```csharp
[SerializeField] VideoPlayer _videoPlayer;

// Create a RenderTexture with Videoplayer frame data.
RenderTexture renderTexture = (RenderTexture)_videoPlayer.texture;
RenderTexture.active = renderTexture;

// Load image from RenderTexture to a Texture2D.
Texture2D texture = new Texture2D(0, 0);
texture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
texture.Apply();
```

### :camera: Camera feed

*Computer webcams, external USB cameras, and phone rear/selfie cameras are supported.*

<pre class="language-csharp"><code class="lang-csharp">[SerializeField] private ImageView _image;
[SerializeField] private WebcamSource _webcam;

// Load the new frame to an ImageView.
_image.Load(_webcam);

<strong>// Load image from ImageView to a Texture2D.
</strong>Texture2D texture = _image.Texture;
</code></pre>

## Step 2: Detect hands

Pass the `Texture2D` from step 1 to a `HandTracker`. The `HandTracker` will detect the hands and fingers in the texture.

```csharp
// Create a handTracker.
HandTracker tracker = new HandTracker();

// Detect hands.
List<Hand> hands = tracker.Load(texture);
```

## Step 3: Access hand & finger data

Access the detected hand's information.&#x20;

```csharp
if (hands.Count > 0)
{
    // Get hand Side. 
    HandSide side = hands[0].Side;
    
    // Get hand Confidence. 
    float confidence = hands[0].Confidence;
    
    // Get Thumb finger.
    Thumb thumb = hands[0].Thumb;
    
    // Get Index finger.
    Index index = hands[0].Index;
    
    // Get Middle finger.
    Middle middle = hands[0].Middle;
    
    // Get Ring finger.
    Ring ring = hands[0].Ring;
    
    // Get Pinky finger.
    Pinky pinky = hands[0].Pinky;
    
    // Get Palm.
    Palm palm = hands[0].Palm;
    
    // Get Pinky MCP finger joint.
    FingerJoint pinkyMCP = pinky.MCP;
    
    // Get Pinky MCP joint 2D position.
    Vector2 screenPosition = pinkyMCP.Position2D;
    
    // Get Pinky MCP joint 3D position.
    Vector3 worldPosition = pinkyMCP.Position3D;
}
```

## Examples

For more detailed examples, check our dedicated Examples section:

{% content-ref url="/pages/VlkQs6eTkqRGi91POAQE" %}
[Detect hand and retrieve joints](/examples/detect-hand-and-retrieve-joints.md)
{% endcontent-ref %}

{% content-ref url="/pages/Vodof9URCBrb91OBVIRc" %}
[No Code: Detect and visualize hands from a Sprite](/examples/no-code-detect-and-visualize-hands-from-a-sprite.md)
{% endcontent-ref %}

{% content-ref url="/pages/oktrLMmh8gE7GLw6TV3l" %}
[Detect and visualize hands from a Sprite](/examples/detect-and-visualize-hands-from-a-sprite.md)
{% endcontent-ref %}

{% content-ref url="/pages/usuACFaZDgmx3x8yaoj2" %}
[Detect and visualize hands from a video](/examples/detect-and-visualize-hands-from-a-video.md)
{% endcontent-ref %}

{% content-ref url="/pages/7LHE6SC5dafNS2aRvC9A" %}
[Use webcam to detect and visualize hands (2D Canvas)](/examples/use-webcam-to-detect-and-visualize-hands-2d-canvas.md)
{% endcontent-ref %}

{% content-ref url="/pages/M2XXl0enlC05xE1xwHoS" %}
[Use webcam to detect and visualize hands (3D World space)](/examples/use-webcam-to-detect-and-visualize-hands-3d-world-space.md)
{% endcontent-ref %}
