Skip to content

Commit 65e771e

Browse files
committed
adding docs
1 parent 9d48d8a commit 65e771e

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,89 @@ videoCamera.track({
4444
> 2. Run a local server: `grunt server`
4545
> 3. Go to: `http://localhost:9001` and have fun :)
4646
47+
## Structure
48+
49+
* *tracking.js* : Library's core;
50+
* *color.js* : Module for color tracking;
51+
* *human.js* : Module for human tracking.
52+
53+
## Methods
54+
55+
There are some handy chainable methods that you can use to achieve your goal, for example:
56+
57+
* **tracking.VideoCamera()**
58+
59+
Requests user's camera using WebRTC's `getUserMedia()`.
60+
61+
* **tracking.VideoCamera().render()**
62+
63+
Shows user's camera using a `<video>` element.
64+
65+
* **tracking.VideoCamera().hide()**
66+
67+
Don't shows user's camera.
68+
69+
* **tracking.VideoCamera().renderVideoCanvas()**
70+
71+
Renders user's camera using a `<canvas>` element.
72+
73+
## Parameters
74+
75+
When initializing the object `tracking.VideoCamera().track()`, you can optionally specify some parameters, for instance:
76+
77+
* **type** *{string}* : could be `color` or `human`.
78+
79+
```
80+
new tracking.VideoCamera().track({
81+
type: 'color'
82+
});
83+
```
84+
85+
### Color tracking
86+
87+
* **color** *{string}* : could be `cyan`, `magenta` or `yellow` (default is `magenta`).
88+
89+
```
90+
new tracking.VideoCamera().track({
91+
type: 'color',
92+
color: 'yellow'
93+
});
94+
```
95+
96+
### Human tracking
97+
98+
* **data** *{string}* : could be `eye`, `frontal_face`, `mouth` or `upper_body` (default is `frontal_face`).
99+
100+
```
101+
new tracking.VideoCamera().track({
102+
type: 'human',
103+
data: 'eye'
104+
});
105+
```
106+
107+
## Events
108+
109+
* **onFound** : Each time your tracker find something this event will be dispared.
110+
111+
```
112+
new tracking.VideoCamera().track({
113+
onFound: function(track) {
114+
// do something
115+
}
116+
});
117+
```
118+
119+
* **onNotFound** : Each time your tracker doesn't find something this event will be dispared.
120+
121+
```
122+
new tracking.VideoCamera().track({
123+
onNotFound: function(track) {
124+
// do something
125+
}
126+
});
127+
```
128+
129+
47130
## About
48131

49132
It brings to web elements tracking techniques of a real scene captured by the camera, through natural interactions from object tracking, color markers, among others, allowing the development of interfaces and games through a simple and intuitive API.

0 commit comments

Comments
 (0)