Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
b-3-n committed Sep 29, 2021
0 parents commit 0153739
Show file tree
Hide file tree
Showing 84 changed files with 11,271 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIT licensed handtracking.
43 changes: 43 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md)

## yoha package

## Functions

| Function | Description |
| --- | --- |
| [Load(sdkUrl)](./yoha.load.md) | Fetches the JavaScript component of the hand tracking API. |

## Interfaces

| Interface | Description |
| --- | --- |
| [IEngine](./yoha.iengine.md) | Hand tracking engine. |
| [IEngineConfig](./yoha.iengineconfig.md) | Engine configuration. |
| [IHandLostEvent](./yoha.ihandlostevent.md) | Event emitted by the engine if a hand was previously detected but is not recognized anymore. |
| [IHandTrackingApi](./yoha.ihandtrackingapi.md) | Top level API returned by the loading script. |
| [ILatencyEvent](./yoha.ilatencyevent.md) | Event that informs about the time it took to analyze one frame. |
| [IPoses](./yoha.iposes.md) | The detected hand poses. |
| [IResultEvent](./yoha.iresultevent.md) | Event that is emitted by the engine to report the hand tracking results. |
| [ISetUpCameraTrackSourceResult](./yoha.isetupcameratracksourceresult.md) | The result of a call to [IEngine.SetUpCameraTrackSource()](./yoha.iengine.setupcameratracksource.md)<!-- -->. |
| [IWarmupResult](./yoha.iwarmupresult.md) | The result of a call to [IEngine.Warmup()](./yoha.iengine.warmup.md)<!-- -->. |

## Variables

| Variable | Description |
| --- | --- |
| [EventEnum](./yoha.eventenum.md) | All types of events that the hand tracking engine may emit. See also [IEvent](./yoha.ievent.md)<!-- -->. |
| [MediaStreamErrorEnum](./yoha.mediastreamerrorenum.md) | Possible error types that can occur when calling navigator.mediaDevices.getUserMedia. |

## Type Aliases

| Type Alias | Description |
| --- | --- |
| [IDownloadProgressCb](./yoha.idownloadprogresscb.md) | Callback that periodically informs about the progress of a download. |
| [IEvent](./yoha.ievent.md) | All events that the hand tracking engine may emit. |
| [IEventCb](./yoha.ieventcb.md) | Event callback. |
| [ITrackSource](./yoha.itracksource.md) | The element to be used as source for the handtracking. Usually this is an HTMLVideoElement. |
| [ObjValues](./yoha.objvalues.md) | A small helper that is used to build a type consisting of all values of an object literal.<br/> |

17 changes: 17 additions & 0 deletions docs/yoha.eventenum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [EventEnum](./yoha.eventenum.md)

## EventEnum variable

All types of events that the hand tracking engine may emit. See also [IEvent](./yoha.ievent.md)<!-- -->.

<b>Signature:</b>

```typescript
EventEnum: {
readonly RESULT: "RESULT";
readonly LOST: "LOST";
readonly LATENCY: "LATENCY";
}
```
18 changes: 18 additions & 0 deletions docs/yoha.idownloadprogresscb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IDownloadProgressCb](./yoha.idownloadprogresscb.md)

## IDownloadProgressCb type

Callback that periodically informs about the progress of a download.

<b>Signature:</b>

```typescript
export declare type IDownloadProgressCb = (progress: number) => void;
```

## Remarks

<b>progress</b>: A number in the range \[0-1\] indicating the progress of fetching the data.

24 changes: 24 additions & 0 deletions docs/yoha.iengine.configure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [Configure](./yoha.iengine.configure.md)

## IEngine.Configure() method

Configures the engine.

<b>Signature:</b>

```typescript
Configure(config?: IEngineConfig): void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| config | [IEngineConfig](./yoha.iengineconfig.md) | Engine configuration. |

<b>Returns:</b>

void

32 changes: 32 additions & 0 deletions docs/yoha.iengine.downloadmodel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [DownloadModel](./yoha.iengine.downloadmodel.md)

## IEngine.DownloadModel() method

Fetches the model files and reports download progress.

<b>Signature:</b>

```typescript
DownloadModel(progressCb?: IDownloadProgressCb): Promise<void>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| progressCb | [IDownloadProgressCb](./yoha.idownloadprogresscb.md) | See [IDownloadProgressCb](./yoha.idownloadprogresscb.md)<!-- -->. |

<b>Returns:</b>

Promise&lt;void&gt;

A promise that resolves once the download is complete.

## Remarks

- This function can be optionally called before [IEngine.Start()](./yoha.iengine.start.md) and [IEngine.Warmup()](./yoha.iengine.warmup.md) to fetch the model data while also being able to observe download progress. If omitted, the first call to either [IEngine.Start()](./yoha.iengine.start.md) or [IEngine.Warmup()](./yoha.iengine.warmup.md) will download the model data which does not provide the ability to observe the download progress.

- The engine relies on a machine learning model to perform the hand tracking. This model consists of learned parameters that have to be fetched before the hand tracking can start.

26 changes: 26 additions & 0 deletions docs/yoha.iengine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md)

## IEngine interface

Hand tracking engine.

<b>Signature:</b>

```typescript
export interface IEngine
```

## Methods

| Method | Description |
| --- | --- |
| [Configure(config)](./yoha.iengine.configure.md) | Configures the engine. |
| [DownloadModel(progressCb)](./yoha.iengine.downloadmodel.md) | Fetches the model files and reports download progress. |
| [SetUpCameraTrackSource()](./yoha.iengine.setupcameratracksource.md) | Creates a webcam stream and sets it up as source for the handtracking. |
| [SetUpCustomTrackSource(trackSource)](./yoha.iengine.setupcustomtracksource.md) | Sets up the engine to use an externally created stream as source for the handtracking. |
| [Start(eventCb)](./yoha.iengine.start.md) | Starts the engine. |
| [Stop()](./yoha.iengine.stop.md) | Stops the engine. |
| [Warmup()](./yoha.iengine.warmup.md) | Prepares and optimizes the engine. |

23 changes: 23 additions & 0 deletions docs/yoha.iengine.setupcameratracksource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [SetUpCameraTrackSource](./yoha.iengine.setupcameratracksource.md)

## IEngine.SetUpCameraTrackSource() method

Creates a webcam stream and sets it up as source for the handtracking.

<b>Signature:</b>

```typescript
SetUpCameraTrackSource(): Promise<ISetUpCameraTrackSourceResult>;
```
<b>Returns:</b>

Promise&lt;[ISetUpCameraTrackSourceResult](./yoha.isetupcameratracksourceresult.md)<!-- -->&gt;

## Remarks

This will ask the user for camera access.

The created webcam stream uses reasonable default values. For full control over the creation of the stream use [IEngine.SetUpCustomTrackSource()](./yoha.iengine.setupcustomtracksource.md) instead.

30 changes: 30 additions & 0 deletions docs/yoha.iengine.setupcustomtracksource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [SetUpCustomTrackSource](./yoha.iengine.setupcustomtracksource.md)

## IEngine.SetUpCustomTrackSource() method

Sets up the engine to use an externally created stream as source for the handtracking.

<b>Signature:</b>

```typescript
SetUpCustomTrackSource(trackSource: ITrackSource): void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| trackSource | [ITrackSource](./yoha.itracksource.md) | The element to use as source for the handtracking (usually an HTMLVideoElement). |

<b>Returns:</b>

void

## Remarks

- Use this method for full control over the webcam stream.

- If there are no special requirements on the webcam stream or to get started consider using [IEngine.SetUpCameraTrackSource()](./yoha.iengine.setupcameratracksource.md) instead.

26 changes: 26 additions & 0 deletions docs/yoha.iengine.start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [Start](./yoha.iengine.start.md)

## IEngine.Start() method

Starts the engine.

<b>Signature:</b>

```typescript
Start(eventCb: IEventCb): Promise<void>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| eventCb | [IEventCb](./yoha.ieventcb.md) | Callback that is called with various events. See [IEvent](./yoha.ievent.md) for more details. |

<b>Returns:</b>

Promise&lt;void&gt;

Promise that resolves after engine has started.

23 changes: 23 additions & 0 deletions docs/yoha.iengine.stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [Stop](./yoha.iengine.stop.md)

## IEngine.Stop() method

Stops the engine.

<b>Signature:</b>

```typescript
Stop(): Promise<void>;
```
<b>Returns:</b>

Promise&lt;void&gt;

Promise that resolves once the engine has stopped.

## Remarks

It is possible to reuse the engine by calling [IEngine.Start()](./yoha.iengine.start.md)<!-- -->.

25 changes: 25 additions & 0 deletions docs/yoha.iengine.warmup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngine](./yoha.iengine.md) &gt; [Warmup](./yoha.iengine.warmup.md)

## IEngine.Warmup() method

Prepares and optimizes the engine.

<b>Signature:</b>

```typescript
Warmup(): Promise<IWarmupResult>;
```
<b>Returns:</b>

Promise&lt;[IWarmupResult](./yoha.iwarmupresult.md)<!-- -->&gt;

Promise that resolves once warmup is complete with estimates about the performance that the engine can provide.

## Remarks

- Performs some dry runs to warm up the engine and to find optimal setup.

- Requires that [IEngine.Configure()](./yoha.iengine.configure.md) was called already.

13 changes: 13 additions & 0 deletions docs/yoha.iengineconfig.flipx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngineConfig](./yoha.iengineconfig.md) &gt; [flipX](./yoha.iengineconfig.flipx.md)

## IEngineConfig.flipX property

If true, mirrors the result coordinates ([IResultEvent.coordinates](./yoha.iresultevent.coordinates.md)<!-- -->) along the y axis. In other words, \[x, y\] becomes \[1 - x, y\].

<b>Signature:</b>

```typescript
flipX?: boolean;
```
21 changes: 21 additions & 0 deletions docs/yoha.iengineconfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngineConfig](./yoha.iengineconfig.md)

## IEngineConfig interface

Engine configuration.

<b>Signature:</b>

```typescript
export interface IEngineConfig
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [flipX?](./yoha.iengineconfig.flipx.md) | boolean | <i>(Optional)</i> If true, mirrors the result coordinates ([IResultEvent.coordinates](./yoha.iresultevent.coordinates.md)<!-- -->) along the y axis. In other words, \[x, y\] becomes \[1 - x, y\]. |
| [padding?](./yoha.iengineconfig.padding.md) | number | <i>(Optional)</i> Starting from the borders, removes a percentage of the analyzed track source.<!-- -->Example: A video with resolution 640x480 would yield landmark coordinates where \[0, 0\] and \[1, 1\] correspond to pixel values of \[1, 1\] and \[640, 480\] respectively.<!-- -->Setting padding to 0.05 would make \[0, 0\] and \[1, 1\] correspond to pixel values of \[640 \* 0.05, 480 \* 0.05\] and \[640 - 640 \* 0.05, 480 - 480 \* 0.05\] respectively. |

17 changes: 17 additions & 0 deletions docs/yoha.iengineconfig.padding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEngineConfig](./yoha.iengineconfig.md) &gt; [padding](./yoha.iengineconfig.padding.md)

## IEngineConfig.padding property

Starting from the borders, removes a percentage of the analyzed track source.

Example: A video with resolution 640x480 would yield landmark coordinates where \[0, 0\] and \[1, 1\] correspond to pixel values of \[1, 1\] and \[640, 480\] respectively.

Setting padding to 0.05 would make \[0, 0\] and \[1, 1\] correspond to pixel values of \[640 \* 0.05, 480 \* 0.05\] and \[640 - 640 \* 0.05, 480 - 480 \* 0.05\] respectively.

<b>Signature:</b>

```typescript
padding?: number;
```
15 changes: 15 additions & 0 deletions docs/yoha.ievent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEvent](./yoha.ievent.md)

## IEvent type

All events that the hand tracking engine may emit.

<b>Signature:</b>

```typescript
export declare type IEvent = IResultEvent | IHandLostEvent | ILatencyEvent;
```
<b>References:</b> [IResultEvent](./yoha.iresultevent.md)<!-- -->, [IHandLostEvent](./yoha.ihandlostevent.md)<!-- -->, [ILatencyEvent](./yoha.ilatencyevent.md)

15 changes: 15 additions & 0 deletions docs/yoha.ieventcb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [yoha](./yoha.md) &gt; [IEventCb](./yoha.ieventcb.md)

## IEventCb type

Event callback.

<b>Signature:</b>

```typescript
export declare type IEventCb = (event: IEvent) => void;
```
<b>References:</b> [IEvent](./yoha.ievent.md)

Loading

0 comments on commit 0153739

Please sign in to comment.