remote-calibrator 0.3.0 → 0.5.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/README.md +29 -19
- package/homepage/example.js +9 -3
- package/i18n/fetch-languages-sheets.js +5 -4
- package/lib/RemoteCalibrator.min.js +1 -1
- package/lib/RemoteCalibrator.min.js.LICENSE.txt +1 -1
- package/lib/RemoteCalibrator.min.js.map +1 -1
- package/package.json +15 -15
- package/src/WebGazer4RC/.gitattributes +10 -0
- package/src/WebGazer4RC/LICENSE.md +15 -0
- package/src/WebGazer4RC/README.md +142 -0
- package/src/WebGazer4RC/gnu-lgpl-v3.0.md +163 -0
- package/src/WebGazer4RC/gplv3.md +636 -0
- package/src/WebGazer4RC/package-lock.json +1133 -0
- package/src/WebGazer4RC/package.json +28 -0
- package/src/WebGazer4RC/src/dom_util.mjs +27 -0
- package/src/WebGazer4RC/src/facemesh.mjs +150 -0
- package/src/WebGazer4RC/src/index.mjs +1235 -0
- package/src/WebGazer4RC/src/mat.mjs +301 -0
- package/src/WebGazer4RC/src/params.mjs +29 -0
- package/src/WebGazer4RC/src/pupil.mjs +109 -0
- package/src/WebGazer4RC/src/ridgeReg.mjs +104 -0
- package/src/WebGazer4RC/src/ridgeRegThreaded.mjs +161 -0
- package/src/WebGazer4RC/src/ridgeWeightedReg.mjs +125 -0
- package/src/WebGazer4RC/src/ridgeWorker.mjs +135 -0
- package/src/WebGazer4RC/src/util.mjs +348 -0
- package/src/WebGazer4RC/src/util_regression.mjs +240 -0
- package/src/WebGazer4RC/src/worker_scripts/mat.js +306 -0
- package/src/WebGazer4RC/src/worker_scripts/util.js +398 -0
- package/src/WebGazer4RC/test/regression_test.js +182 -0
- package/src/WebGazer4RC/test/run_tests_and_server.sh +24 -0
- package/src/WebGazer4RC/test/util_test.js +60 -0
- package/src/WebGazer4RC/test/webgazerExtract_test.js +40 -0
- package/src/WebGazer4RC/test/webgazer_test.js +160 -0
- package/src/WebGazer4RC/test/www_page_test.js +41 -0
- package/src/const.js +3 -0
- package/src/core.js +8 -0
- package/src/css/distance.scss +40 -0
- package/src/css/panel.scss +32 -1
- package/src/distance/distance.js +4 -4
- package/src/distance/distanceCheck.js +115 -0
- package/src/distance/distanceTrack.js +99 -41
- package/src/{interpupillaryDistance.js → distance/interPupillaryDistance.js} +14 -12
- package/src/gaze/gazeTracker.js +16 -1
- package/src/i18n.js +1 -1
- package/src/index.js +2 -1
- package/src/panel.js +32 -3
- package/webpack.config.js +4 -4
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Latency for gaze and viewing distance tracking. The latency is calculated by comparing the timestamps of the moment when the video stream is fed into the model for estimation and when the result is produced and recorded. You can access it by `data.value.latencyMs` where `data` is the argument passed into the callback function of `.trackGaze()` and `.trackDistance`.
|
13
|
+
- Viewing distance monitoring. Three new options for `.trackDistance()` are added: `desiredDistanceCm` (default undefined), `desiredDistanceTolerance` (default 0.1), and `desiredDistanceMonitor` (default false). If a number is given for `desiredDistanceCm`, the program will check the viewing distance and call for "Move CLOSER." or "Move FURTHER." to the participants, until the participant moved to the desired distance and the experiment will resume. Setting `desiredDistanceMonitor` to true will repeat this process through the rest of the experiment.
|
14
|
+
- `debug` and `i18n` options of `.panel()`. When set to `true`, The first one adds some useful options, e.g., to skip calibration, for you to use when debugging. The second one adds a language picker for participants to choose their own languages (the default choice is always the one set on initiation).
|
15
|
+
- Update near point tracking to be more accurate. The webcam is assumed to be at the top middle of the screen.
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Rename "Head Tracking" to "Distance Tracking" globally.
|
20
|
+
- Polish translations.
|
21
|
+
|
10
22
|
## [0.3.0] - 2021-10-16
|
11
23
|
|
12
24
|
### Added
|
package/README.md
CHANGED
@@ -45,18 +45,18 @@ RemoteCalibrator.measureDistance({}, data => {
|
|
45
45
|
|
46
46
|
## Functions
|
47
47
|
|
48
|
-
| Task
|
49
|
-
|
|
50
|
-
| [🎬 Initialize](#-initialize)
|
51
|
-
| [🍱 Panel](#-panel)
|
52
|
-
| [🖥️ Screen](#️-screen)
|
53
|
-
| [📏 Viewing Distance](#-viewing-distance)
|
54
|
-
| [🙂
|
55
|
-
| [👀 Gaze](#-gaze)
|
56
|
-
| [💻 Environment](#-environment)
|
57
|
-
| [💄 Customization](#-customization)
|
58
|
-
| [📔 Other Functions](#-other-functions)
|
59
|
-
| [🎣 Getters](#-getters)
|
48
|
+
| Task | Functions |
|
49
|
+
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
50
|
+
| [🎬 Initialize](#-initialize) | [`init()`](#-initialize) (always required) |
|
51
|
+
| [🍱 Panel](#-panel) | [`async panel()`](#-panel) `removePanel()` `resetPanel()` |
|
52
|
+
| [🖥️ Screen](#️-screen) | [Display Pixel Dimensions](#measure-display-pixels) [`screenSize()`](#measure-screen-size) |
|
53
|
+
| [📏 Viewing Distance](#-viewing-distance) | [`measureDistance()`](#-viewing-distance) |
|
54
|
+
| [🙂 Distance Tracking](#-distance-tracking) | (viewing distance and [near point](#near-point)) [`trackDistance()`](#-distance-tracking) [`async getDistanceNow()`](#async-get-distance-now) [`checkDistance()`](#check-distance) [Lifecycle](#lifecycle) [Others](#others) |
|
55
|
+
| [👀 Gaze](#-gaze) | [`trackGaze()`](#start-tracking) [`async getGazeNow()`](#async-get-gaze-now) [`calibrateGaze()`](#calibrate) [`getGazeAccuracy()`](#get-accuracy-) [Lifecycle](#lifecycle-1) [Others](#others-1) |
|
56
|
+
| [💻 Environment](#-environment) | [System and Browser Environment](#-environment) |
|
57
|
+
| [💄 Customization](#-customization) | `backgroundColor()` `videoOpacity()` `showCancelButton()` |
|
58
|
+
| [📔 Other Functions](#-other-functions) | `checkInitialized()` `getFullscreen()` `newLanguage()` |
|
59
|
+
| [🎣 Getters](#-getters) | [Experiment](#experiment) [Environment](#environment) [i18n](#i18n) [All Data](#all-data) [Others](#others-2) |
|
60
60
|
|
61
61
|
Arguments in square brackets are optional, e.g. `init([options, [callback]])` means both `options` configuration and the `callback` function are optional, but you have to put `options`, e.g., `{}`, if you want to call the callback function. The default values of `options` are listed in each section with explanation.
|
62
62
|
|
@@ -226,15 +226,15 @@ Pass `{ value, timestamp, method }` (equivalent to `RemoteCalibrator.viewingDist
|
|
226
226
|
}
|
227
227
|
```
|
228
228
|
|
229
|
-
### 🙂
|
229
|
+
### 🙂 Distance Tracking
|
230
230
|
|
231
231
|
```js
|
232
232
|
.trackDistance([options, [callbackStatic, [callbackTrack]]])
|
233
233
|
```
|
234
234
|
|
235
|
-
Measure the viewing distance and then predict the real-time distance based on the change of the
|
235
|
+
Measure the viewing distance and then predict the real-time distance based on the change of the inter-pupillary distance, measured by [face landmarks](https://github.com/tensorflow/tfjs-models/tree/master/face-landmarks-detection). `callbackStatic` is called after getting the blind spot result and `callbackTrack` is called every time a new result from estimation is derived.
|
236
236
|
|
237
|
-
Pass `{ value: { viewingDistanceCm, nearPointCm: { x, y } }, timestamp, method }` to callback.
|
237
|
+
Pass `{ value: { viewingDistanceCm, nearPointCm: { x, y }, latencyMs }, timestamp, method }` to callback.
|
238
238
|
|
239
239
|
`method` can be either `"BlindSpot"` (for measures from blind spot tests) or `"FaceMesh"` (for later dynamic estimates).
|
240
240
|
|
@@ -247,12 +247,14 @@ Pass `{ value: { viewingDistanceCm, nearPointCm: { x, y } }, timestamp, method }
|
|
247
247
|
showVideo: true,
|
248
248
|
showFaceOverlay: false,
|
249
249
|
decimalPlace: 1,
|
250
|
-
// Measurement per second
|
251
|
-
|
250
|
+
framerate: 3, // Measurement per second
|
251
|
+
desiredDistanceCm: undefined,
|
252
|
+
desiredDistanceTolerance: 0.1, // Range [0.1, 1]
|
253
|
+
desiredDistanceMonitor: false,
|
252
254
|
// Near point
|
253
255
|
nearPoint: true,
|
254
256
|
showNearPoint: false,
|
255
|
-
headline: "🙂 Set up for
|
257
|
+
headline: "🙂 Set up for Distance Tracking",
|
256
258
|
description: "...",
|
257
259
|
}
|
258
260
|
```
|
@@ -265,6 +267,14 @@ Pass `{ value: { viewingDistanceCm, nearPointCm: { x, y } }, timestamp, method }
|
|
265
267
|
|
266
268
|
You can pause active distance tracking, and use this function to get the latest distance at the moment when the user makes reactions. If no callback function is passed in, it will use the one from `.trackDistance()` as the default.
|
267
269
|
|
270
|
+
#### Check Distance
|
271
|
+
|
272
|
+
```js
|
273
|
+
.checkDistance(desiredCm, errorTolerance)
|
274
|
+
```
|
275
|
+
|
276
|
+
Check the current viewing distance and compare it to the desired distance. Guide the participant to the target distance if needed.
|
277
|
+
|
268
278
|
#### Near Point
|
269
279
|
|
270
280
|
The observer's near point is the orthogonal nearest viewing point in the screen, or the plane containing the screen. To track the near point, we assume that the webcam view is orthogonal to the display, and it is placed around 0.5cm above the top center of the screen (e.g., the built-in webcam of a MacBook). Our method is based on the Facemesh model and can give you an approximate estimation of the near point.
|
@@ -438,7 +448,7 @@ Use the following keywords to retrieve the whole dataset.
|
|
438
448
|
- `.screenData`
|
439
449
|
- `.viewingDistanceData`
|
440
450
|
- `.nearPointData`
|
441
|
-
- `.PDData` (
|
451
|
+
- `.PDData` (Inter-pupillary distance data)
|
442
452
|
- `.gazeData`
|
443
453
|
- `.fullscreenData`
|
444
454
|
- `.environmentData`
|
package/homepage/example.js
CHANGED
@@ -202,9 +202,11 @@ function trackViewingDistance(e) {
|
|
202
202
|
let trackP
|
203
203
|
RemoteCalibrator.trackDistance(
|
204
204
|
{
|
205
|
-
showVideo:
|
205
|
+
showVideo: true,
|
206
206
|
nearPoint: true,
|
207
207
|
showNearPoint: true,
|
208
|
+
desiredDistanceCm: 60,
|
209
|
+
desiredDistanceMonitor: true,
|
208
210
|
},
|
209
211
|
distanceData => {
|
210
212
|
measureDistanceCallback(distanceData)
|
@@ -219,7 +221,9 @@ function trackViewingDistance(e) {
|
|
219
221
|
data.method
|
220
222
|
} method. The near point is at [${data.value.nearPointCm.x} cm, ${
|
221
223
|
data.value.nearPointCm.y
|
222
|
-
} cm] compared to the center of the screen
|
224
|
+
} cm] compared to the center of the screen. Latency is ${
|
225
|
+
data.value.latencyMs
|
226
|
+
} ms.`
|
223
227
|
)
|
224
228
|
}
|
225
229
|
)
|
@@ -317,7 +321,9 @@ function trackGaze(e) {
|
|
317
321
|
gazeP.innerHTML = gotData(
|
318
322
|
`The gaze position is [${data.value.x} px, ${
|
319
323
|
data.value.y
|
320
|
-
} px] at ${parseTimestamp(data.timestamp)}
|
324
|
+
} px] at ${parseTimestamp(data.timestamp)}. Latency is ${
|
325
|
+
data.value.latencyMs
|
326
|
+
} ms.`
|
321
327
|
)
|
322
328
|
}
|
323
329
|
)
|
@@ -14,7 +14,7 @@ async function processLanguageSheet() {
|
|
14
14
|
const rows = await googleSheets.spreadsheets.values.get({
|
15
15
|
auth,
|
16
16
|
spreadsheetId,
|
17
|
-
range: '
|
17
|
+
range: 'Translations',
|
18
18
|
})
|
19
19
|
|
20
20
|
const rowsJSON = XLSX.utils.sheet_to_json(
|
@@ -34,9 +34,10 @@ async function processLanguageSheet() {
|
|
34
34
|
for (let phrase in data) {
|
35
35
|
for (let lang in data[phrase]) {
|
36
36
|
if (data[phrase][lang].includes('XX'))
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
while (data[phrase][lang].includes('XX'))
|
38
|
+
data[phrase][lang] = data[phrase][lang]
|
39
|
+
.replace('XXX', 'xxx')
|
40
|
+
.replace('XX', 'xx')
|
40
41
|
}
|
41
42
|
}
|
42
43
|
|